Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/super-editor/src/core/super-converter/exporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export function exportSchemaToJson(params) {
shapeTextbox: translateShapeTextbox,
contentBlock: translateContentBlock,
structuredContent: translateStructuredContent,
structuredContentBlock: translateStructuredContent,
documentSection: translateDocumentSection,
'page-number': translatePageNumberNode,
'total-page-number': translateTotalPageNumberNode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,19 @@ export const handleSdtNode = (params) => {
} catch {}

const sdtContent = node.elements.find((el) => el.name === 'w:sdtContent');
const par = sdtContent?.elements?.find((el) => el.name === 'w:p');
const { marks } = parseAnnotationMarks(sdtContent);

const translatedContent = nodeListHandler.handler({ ...params, nodes: sdtContent?.elements });

let structuredContentType = 'structuredContent';
if (par) {
// If a paragraph or potentially another block node is found.
structuredContentType = 'structuredContentBlock';
Comment thread
harbournick marked this conversation as resolved.
}

let result = {
type: 'structuredContent',
type: structuredContentType,
content: translatedContent,
marks,
attrs: {
Expand Down
4 changes: 3 additions & 1 deletion packages/super-editor/src/extensions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { PageNumber, TotalPageCount } from './page-number/index.js';
import { ShapeContainer } from './shape-container/index.js';
import { ShapeTextbox } from './shape-textbox/index.js';
import { ContentBlock } from './content-block/index.js';
import { StructuredContent, DocumentSection } from './structured-content/index.js';
import { StructuredContent, StructuredContentBlock, DocumentSection } from './structured-content/index.js';
import { BlockNode } from './block-node/index.js';

// Marks extensions
Expand Down Expand Up @@ -174,6 +174,7 @@ const getStarterExtensions = () => {
ContentBlock,
Search,
StructuredContent,
StructuredContentBlock,
DocumentSection,
NodeResizer,
CustomSelection,
Expand Down Expand Up @@ -241,6 +242,7 @@ export {
AiPlugin,
Search,
StructuredContent,
StructuredContentBlock,
DocumentSection,
NodeResizer,
CustomSelection,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './structured-content.js';
export * from './structured-content-block.js';
export * from './document-section.js';
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { Node, Attribute } from '@core/index.js';

export const StructuredContentBlock = Node.create({
name: 'structuredContentBlock',

group: 'block',

content: 'block*',

addOptions() {
return {
structuredContentClass: 'sd-structured-content-tag',
htmlAttributes: {
'aria-label': 'Structured content block node',
},
};
},

parseDOM() {
return [{ tag: `div.${this.options.structuredContentClass}` }];
},

renderDOM({ htmlAttributes }) {
return ['div', Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
},

addAttributes() {
return {
sdtPr: {
rendered: false,
},
};
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,24 @@ import { Node, Attribute } from '@core/index.js';

export const StructuredContent = Node.create({
name: 'structuredContent',

group: 'inline',

inline: true,

content: 'inline*',

addOptions() {
return {
annotationClass: 'sd-structured-content-tag',
structuredContentClass: 'sd-structured-content-tag',
htmlAttributes: {
'aria-label': 'Structured content node',
},
};
},

parseDOM() {
return [
{
tag: `span.${this.options.annotationClass}`,
priority: 60,
},
];
return [{ tag: `span.${this.options.structuredContentClass}` }];
},

renderDOM({ htmlAttributes }) {
Expand Down
5 changes: 0 additions & 5 deletions packages/superdoc/src/stores/comments-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,11 +467,6 @@ export const useCommentsStore = defineStore('comments', () => {

const createCommentForTrackChanges = (editor) => {
let trackedChanges = trackChangesHelpers.getTrackChanges(editor.state);
let isLargeDoc = editor.state.doc.nodeSize >= 100_000;

if (isLargeDoc && trackedChanges.length) {
trackedChanges = trackedChanges.slice(0, 100);
}

const groupedChanges = groupChanges(trackedChanges);

Expand Down
Loading