Skip to content
Open
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
5 changes: 4 additions & 1 deletion packages/template-builder/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
type Editor = NonNullable<SuperDoc['activeEditor']>;

const applyDocumentMode = (instance: SuperDoc, mode: string) => {
(instance as any).setDocumentMode(mode);

Check warning on line 19 in packages/template-builder/src/index.tsx

View workflow job for this annotation

GitHub Actions / CI Template Builder / validate

Unexpected any. Specify a different type
};

const getTemplateFieldsFromEditor = (editor: Editor): Types.TemplateField[] => {
const structuredContentHelpers = (editor.helpers as any)?.structuredContentCommands;

Check warning on line 23 in packages/template-builder/src/index.tsx

View workflow job for this annotation

GitHub Actions / CI Template Builder / validate

Unexpected any. Specify a different type

if (!structuredContentHelpers?.getStructuredContentTags) {
return [];
Expand All @@ -28,7 +28,7 @@

const tags = structuredContentHelpers.getStructuredContentTags(editor.state) || [];

return tags.map((entry: any) => {

Check warning on line 31 in packages/template-builder/src/index.tsx

View workflow job for this annotation

GitHub Actions / CI Template Builder / validate

Unexpected any. Specify a different type
const node = entry?.node ?? entry;
const attrs = node?.attrs ?? {};
const nodeType = node?.type?.name || '';
Expand Down Expand Up @@ -103,7 +103,10 @@
const trigger = menu.trigger || '{{';

const availableFields = fieldsRef.current.available || [];
const toolbarSettings = useMemo(() => resolveToolbar(toolbar), [toolbar]);
// Serialize so structurally-equal toolbar objects compare as equal across
// renders — otherwise a fresh inline `toolbar={{...}}` literal would
// recreate the SuperDoc instance every parent render.
const toolbarSettings = useMemo(() => resolveToolbar(toolbar), [JSON.stringify(toolbar)]);
const stableTelemetry = useMemo(
() => ({
enabled: telemetry?.enabled ?? true,
Expand Down Expand Up @@ -386,7 +389,7 @@
const editor = instance.activeEditor;
const pe = getPresentationEditor(instance);

editor.on('update', ({ editor: e }: any) => {

Check warning on line 392 in packages/template-builder/src/index.tsx

View workflow job for this annotation

GitHub Actions / CI Template Builder / validate

Unexpected any. Specify a different type
const { state } = e;
const { from } = state.selection;

Expand All @@ -403,7 +406,7 @@
if (!editor) return;
const currentPos = editor.state.selection.from;
const tr = editor.state.tr.delete(triggerStart, currentPos);
(editor as any).view.dispatch(tr);

Check warning on line 409 in packages/template-builder/src/index.tsx

View workflow job for this annotation

GitHub Actions / CI Template Builder / validate

Unexpected any. Specify a different type
};

triggerCleanupRef.current = cleanup;
Expand Down Expand Up @@ -572,7 +575,7 @@
const editor = superdocRef.current?.activeEditor;
if (!editor) return;

const structuredContentHelpers = (editor.helpers as any)?.structuredContentCommands;

Check warning on line 578 in packages/template-builder/src/index.tsx

View workflow job for this annotation

GitHub Actions / CI Template Builder / validate

Unexpected any. Specify a different type

if (!structuredContentHelpers) return;

Expand Down
Loading