Skip to content

Commit 8e86a2d

Browse files
committed
latest
1 parent d7c80bb commit 8e86a2d

21 files changed

Lines changed: 71 additions & 539 deletions

File tree

packages/super-editor/package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@
7373
"tippy.js": "^6.3.7",
7474
"vite-plugin-node-polyfills": "^0.22.0",
7575
"y-prosemirror": "^1.2.12",
76-
"yjs": "13.6.19",
77-
"@floating-ui/dom": "^1.7.0"
76+
"yjs": "13.6.19"
7877
},
7978
"devDependencies": {
8079
"@playwright/test": "^1.51.0",
@@ -88,7 +87,6 @@
8887
"vite": "^5.4.12",
8988
"vitest": "^1.6.1",
9089
"vue-draggable-next": "^2.2.1",
91-
"which": "^5.0.0",
92-
"@floating-ui/dom": "^1.7.0"
90+
"which": "^5.0.0"
9391
}
9492
}
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
@import './prosemirror.css';
22
@import './toolbar.css';
33
@import './ai.css';
4-
@import './page-number.css';

packages/super-editor/src/assets/styles/elements/page-number.css

Lines changed: 0 additions & 15 deletions
This file was deleted.

packages/super-editor/src/components/SuperEditor.vue

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,7 @@ onBeforeUnmount(() => {
242242
</div>
243243
</template>
244244
245-
246245
<style scoped>
247-
.editor-element {
248-
position: relative;
249-
}
250-
251246
.super-editor-container {
252247
width: auto;
253248
height: auto;

packages/super-editor/src/components/pagination-helpers.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ export function adjustPaginationBreaks(editorElem, editor) {
2323
if (!firstLeft) firstLeft = left;
2424
if (left !== firstLeft) {
2525
const diff = left - firstLeft;
26-
// Note: elements with "position: fixed" do not work correctly with transform style.
27-
// node.style.left = `${diff}px`;
2826
node.style.transform = `translateX(${diff}px)`;
2927
}
3028
});
31-
};
29+
};

packages/super-editor/src/core/Editor.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { EditorState, TextSelection } from 'prosemirror-state';
1+
import { EditorState } from 'prosemirror-state';
22
import { EditorView } from 'prosemirror-view';
33
import { DOMParser, DOMSerializer } from 'prosemirror-model';
44
import { yXmlFragmentToProseMirrorRootNode } from 'y-prosemirror';
@@ -24,7 +24,6 @@ import { generateCollaborationData } from '@extensions/collaboration/collaborati
2424
import { toggleHeaderFooterEditMode } from '../extensions/pagination/pagination-helpers.js';
2525
import { hasSomeParentWithClass } from './super-converter/helpers.js';
2626
import { useHighContrastMode } from '../composables/use-high-contrast-mode.js';
27-
import { findWordBounds } from './helpers/findWordBounds.js';
2827
/**
2928
* @typedef {Object} FieldValue
3029
* @property {string} input_id The id of the input field
@@ -576,7 +575,6 @@ export class Editor extends EventEmitter {
576575

577576
const doc = this.#generatePmData();
578577
const tr = this.state.tr.replaceWith(0, this.state.doc.content.size, doc);
579-
tr.setMeta('replaceContent', true);
580578
this.view.dispatch(tr);
581579
}
582580

@@ -950,12 +948,6 @@ export class Editor extends EventEmitter {
950948
pm.classList.remove('header-footer-edit');
951949
pm.setAttribute('aria-readonly', false);
952950
}
953-
954-
// Imitate default double click behavior - word selection
955-
const { state, dispatch } = view;
956-
const word = findWordBounds(state.doc, pos);
957-
const tr = state.tr.setSelection(TextSelection.create(state.doc, word.from, word.to));
958-
dispatch(tr);
959951
}
960952
});
961953

packages/super-editor/src/core/helpers/annotator.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -416,9 +416,9 @@ export const cleanUpListsWithAnnotations = (fieldsToDelete = [], editor) => {
416416

417417
child.children.forEach((inline) => {
418418
const isFieldToDelete = fieldsToDelete.includes(inline.attrs.fieldId);
419-
const isFieldType = inline.type.name === 'fieldAnnotation';
420-
const isMatchingField = isFieldType && isFieldToDelete;
421-
if (!isFieldType && !isMatchingField) hasOtherNodes = true;
419+
const isMatchingField = inline.type.name === 'fieldAnnotation' && isFieldToDelete;
420+
const isEmpty = inline.childCount === 0;
421+
if (!isEmpty && !isMatchingField) hasOtherNodes = true;
422422
if (isMatchingField) matchingNodesFound += 1;
423423
});
424424
});

packages/super-editor/src/core/helpers/findWordBounds.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

packages/super-editor/src/core/super-converter/exporter.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ export function exportSchemaToJson(params) {
9292
shapeTextbox: translateShapeTextbox,
9393
contentBlock: translateContentBlock,
9494
structuredContent: translateStructuredContent,
95-
"page-number": translatePageNumberNode,
96-
"total-page-number": translateTotalPageNumberNode,
9795
};
9896

9997
if (!router[type]) {

packages/super-editor/src/core/super-converter/v2/importer/autoPageNumberImporter.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,9 @@ const handleAutoPageNumber = (params) => {
88
if (nodes.length === 0 || nodes[0].name !== 'sd:autoPageNumber') {
99
return { nodes: [], consumed: 0 };
1010
}
11-
12-
const rPr = nodes[0].elements?.find((el) => el.name === 'w:rPr');
13-
const marks = parseMarks(rPr || { elements: [] });
11+
1412
const processedNode = {
1513
type: 'page-number',
16-
attrs: {
17-
marksAsAttrs: marks,
18-
},
1914
};
2015
return { nodes: [processedNode], consumed: 1 };
2116
};
@@ -37,13 +32,8 @@ const handleAutoTotalPageNumber = (params) => {
3732
return { nodes: [], consumed: 0 };
3833
}
3934

40-
const rPr = nodes[0].elements?.find((el) => el.name === 'w:rPr');
41-
const marks = parseMarks(rPr || { elements: [] });
4235
const processedNode = {
4336
type: 'total-page-number',
44-
attrs: {
45-
marksAsAttrs: marks,
46-
},
4737
};
4838
return { nodes: [processedNode], consumed: 1 };
4939
};

0 commit comments

Comments
 (0)