chore: Refactor upload placeholder (#5898)
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
import { EditorState } from "prosemirror-state";
|
||||
|
||||
const findAttachmentById = function (
|
||||
state: EditorState,
|
||||
id: string
|
||||
): [number, number] | null {
|
||||
let result: [number, number] | null = null;
|
||||
|
||||
state.doc.descendants((node, pos) => {
|
||||
if (result) {
|
||||
return false;
|
||||
}
|
||||
if (node.type.name === "attachment" && node.attrs.id === id) {
|
||||
result = [pos, pos + node.nodeSize];
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
export default findAttachmentById;
|
||||
Reference in New Issue
Block a user