chore: Refactor upload placeholder (#5898)

This commit is contained in:
Tom Moor
2023-09-28 23:13:40 -04:00
committed by GitHub
parent f4fd9dae5f
commit 5397907599
7 changed files with 135 additions and 155 deletions

View File

@@ -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;