aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/formattedText/FormattedTextBox.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2021-03-18 11:31:20 -0400
committerbobzel <zzzman@gmail.com>2021-03-18 11:31:20 -0400
commited83093961b7e19df4675c9e2cf0a78eae333614 (patch)
tree2bb28d0d964f1a6c3c6ceb28f35c94180752b299 /src/client/views/nodes/formattedText/FormattedTextBox.tsx
parent26fc8ca2af1697069eb9ba6128abd013550daf2e (diff)
made linkanchorbuttons not show up next to pdf annos. gave pdfannos a baseProto. made textboxes dynamically remove hashtags when deleted from text.
Diffstat (limited to 'src/client/views/nodes/formattedText/FormattedTextBox.tsx')
-rw-r--r--src/client/views/nodes/formattedText/FormattedTextBox.tsx12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
index d44867541..af9aeea00 100644
--- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx
+++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
@@ -250,6 +250,18 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<(FieldViewProp
json?.replace(/"selection":.*/, "") : json?.replace(/"selection":"\"storedMarks\""/, "\"storedMarks\"");
if (effectiveAcl === AclEdit || effectiveAcl === AclAdmin) {
+ const accumTags = [] as string[]
+ state.tr.doc.nodesBetween(0, state.doc.content.size, (node: any, pos: number, parent: any) => {
+ if (node.type === schema.nodes.dashField && node.attrs.fieldKey.startsWith("#")) {
+ accumTags.push(node.attrs.fieldKey)
+ }
+ });
+ const curTags = Object.keys(this.dataDoc).filter(key => key.startsWith("#"));
+ const added = accumTags.filter(tag => !curTags.includes(tag));
+ const removed = curTags.filter(tag => !accumTags.includes(tag));
+ removed.forEach(r => this.dataDoc[r] = undefined);
+ added.forEach(a => this.dataDoc[a] = a);
+
let unchanged = true;
if (this._applyingChange !== this.fieldKey && removeSelection(json) !== removeSelection(curProto?.Data)) {
this._applyingChange = this.fieldKey;