Skip to content

Commit c1b72f8

Browse files
committed
latest
1 parent 2a026ac commit c1b72f8

4 files changed

Lines changed: 29 additions & 29 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,7 @@ export class Editor extends EventEmitter {
933933
return;
934934
}
935935
event.stopPropagation();
936-
936+
937937
if (!this.options.editable) {
938938
// ToDo don't need now but consider to update pagination when recalculate header/footer height
939939
// this.storage.pagination.sectionData = await initPaginationData(this);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const handleAutoPageNumber = (params) => {
66
if (nodes.length === 0 || nodes[0].name !== 'sd:autoPageNumber') {
77
return { nodes: [], consumed: 0 };
88
}
9-
9+
1010
const processedNode = {
1111
type: 'page-number',
1212
};

packages/super-editor/src/extensions/field-annotation/field-annotation.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ export const FieldAnnotation = Node.create({
227227
default: false,
228228
parseDOM: (elem) => elem.getAttribute('data-italic') === 'true',
229229
renderDOM: (attrs) => {
230-
if (!attrs.italic) return {};
230+
if (!attrs.italic || attrs.rawHtml) return {};
231231
return {
232232
'data-italic': 'true',
233233
style: 'font-style: italic',
@@ -239,7 +239,7 @@ export const FieldAnnotation = Node.create({
239239
default: false,
240240
parseDOM: (elem) => elem.getAttribute('data-underline') === 'true',
241241
renderDOM: (attrs) => {
242-
if (!attrs.underline) return {};
242+
if (!attrs.underline || attrs.rawHtml) return {};
243243
return {
244244
'data-underline': 'true',
245245
style: 'text-decoration: underline',
@@ -251,7 +251,7 @@ export const FieldAnnotation = Node.create({
251251
default: null,
252252
parseDOM: (elem) => elem.getAttribute('data-font-family') || elem.style.fontFamily || null,
253253
renderDOM: (attrs) => {
254-
if (!attrs.fontFamily) return {};
254+
if (!attrs.fontFamily || attrs.rawHtml) return {};
255255
return {
256256
'data-font-family': attrs.fontFamily,
257257
style: `font-family: ${attrs.fontFamily}`,
@@ -263,7 +263,7 @@ export const FieldAnnotation = Node.create({
263263
default: null,
264264
parseDOM: (elem) => elem.getAttribute('data-font-size') || elem.style.fontSize || null,
265265
renderDOM: (attrs) => {
266-
if (!attrs.fontSize) return {};
266+
if (!attrs.fontSize || attrs.rawHtml) return {};
267267
let [value, unit] = parseSizeUnit(attrs.fontSize);
268268
if (Number.isNaN(value)) return {};
269269
unit = unit ? unit : 'pt';
@@ -279,7 +279,7 @@ export const FieldAnnotation = Node.create({
279279
default: null,
280280
parseDOM: (element) => element.getAttribute('data-text-highlight'),
281281
renderDOM: (attrs) => {
282-
if (!attrs.textHighlight) return {};
282+
if (!attrs.textHighlight || attrs.rawHtml) return {};
283283
return {
284284
'data-text-highlight': attrs.textHighlight,
285285
// takes precedence over the fieldColor.
@@ -292,7 +292,7 @@ export const FieldAnnotation = Node.create({
292292
default: null,
293293
parseDOM: (element) => element.getAttribute('data-text-color'),
294294
renderDOM: (attrs) => {
295-
if (!attrs.textColor) return {};
295+
if (!attrs.textColor || attrs.rawHtml) return {};
296296
return {
297297
'data-text-color': attrs.textColor,
298298
style: `color: ${attrs.textColor}`,

packages/super-editor/src/extensions/pagination/pagination.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export const Pagination = Extension.create({
116116
shouldUpdate = true;
117117
if (isDebugging) console.debug('🚀 UPDATE DECORATIONS')
118118
if (isForceUpdate) shouldUpdate = true;
119-
119+
120120
return {
121121
...oldState,
122122
isReadyToInit: shouldInitialize,
@@ -160,10 +160,10 @@ export const Pagination = Extension.create({
160160
/**
161161
* Get the correct header or footer ID based on the current page number and section type
162162
* Consider wether or not we need to alternate odd/even pages or if we have a title page
163-
*
164-
* @param {Number} currentPageNumber
165-
* @param {String} sectionType
166-
* @param {Editor} editor
163+
*
164+
* @param {Number} currentPageNumber
165+
* @param {String} sectionType
166+
* @param {Editor} editor
167167
* @returns {String|null} The header or footer ID
168168
*/
169169
const getHeaderFooterId = (currentPageNumber, sectionType, editor, node = null) => {
@@ -288,7 +288,7 @@ const calculatePageBreaks = (view, editor, sectionData) => {
288288
// Clean up
289289
tempView.destroy();
290290
document.body.removeChild(tempContainer);
291-
291+
292292
// Return a list of page break decorations
293293
return DecorationSet.create(view.state.doc, decorations);
294294
};
@@ -336,10 +336,10 @@ function generateInternalPageBreaks(doc, view, editor, sectionData) {
336336
doc.descendants((node, pos) => {
337337
let currentNode = node;
338338
let currentPos = pos;
339-
339+
340340
coords = view?.coordsAtPos(currentPos);
341341
if (!coords) return;
342-
342+
343343
let shouldAddPageBreak = coords.bottom > pageHeightThreshold;
344344
let isHardBreakNode = currentNode.type.name === 'hardBreak';
345345

@@ -507,10 +507,10 @@ function createHeader(pageMargins, pageSize, sectionData, headerId, editor) {
507507
}
508508

509509
const data = editor.converter.headers[headerId];
510-
const editorSection = createHeaderFooterEditor({
511-
editor,
512-
data,
513-
editorContainer,
510+
const editorSection = createHeaderFooterEditor({
511+
editor,
512+
data,
513+
editorContainer,
514514
appendToBody: false,
515515
sectionId: headerId,
516516
type: 'header',
@@ -534,7 +534,7 @@ function createHeader(pageMargins, pageSize, sectionData, headerId, editor) {
534534
if (isDebugging) editorContainer.style.backgroundColor = '#00aaaa55';
535535

536536
editorContainer.addEventListener('dblclick', () => onHeaderFooterDblClick(editor, editorSection));
537-
537+
538538
return {
539539
section: editorContainer,
540540
headerHeight: headerHeight,
@@ -582,10 +582,10 @@ function createFooter(pageMargins, pageSize, sectionData, footerId, editor, curr
582582
}
583583

584584
const data = editor.converter.footers[footerId];
585-
const editorSection = createHeaderFooterEditor({
586-
editor,
587-
data,
588-
editorContainer,
585+
const editorSection = createHeaderFooterEditor({
586+
editor,
587+
data,
588+
editorContainer,
589589
appendToBody: false,
590590
sectionId: footerId,
591591
type: 'footer',
@@ -631,7 +631,7 @@ const onHeaderFooterDblClick = (editor, currentFocusedSectionEditor) => {
631631

632632
/**
633633
* Combine header and footer into a page break element
634-
* @param {Object} param0
634+
* @param {Object} param0
635635
* @param {Editor} param0.editor The editor instance
636636
* @param {HTMLElement} param0.header The header element
637637
* @param {HTMLElement} param0.footer The footer element
@@ -651,7 +651,7 @@ function createPageBreak({ editor, header, footer, footerBottom = null, isFirstH
651651
if (isFirstHeader) innerDiv.style.borderRadius = '8px 8px 0 0';
652652
else if (isLastFooter) innerDiv.style.borderRadius = '0 0 8px 8px';
653653
paginationDiv.appendChild(innerDiv);
654-
654+
655655
if (footer) {
656656
innerDiv.appendChild(footer.section);
657657
sectionHeight += footer.footerHeight;
@@ -688,14 +688,14 @@ function createPageBreak({ editor, header, footer, footerBottom = null, isFirstH
688688
paginationDiv.style.position = 'absolute';
689689
paginationDiv.style.bottom = footerBottom + 'px';
690690
}
691-
691+
692692
return paginationDiv;
693693
}
694694

695695
/**
696696
* Get the actual break coordinates for a page split based on the approximate position (pos)
697697
* and the calculated threshold (which accounts for 'scale')
698-
*
698+
*
699699
* Since we know the node at pos extends past the threshold, we iterate
700700
* backwards through all positions from there to find the exact break point
701701
* @param {EditorView} view The current editor view

0 commit comments

Comments
 (0)