Skip to content

Commit

Permalink
various improvments to the meta settings extension
Browse files Browse the repository at this point in the history
  • Loading branch information
Ell1ott committed Feb 22, 2024
1 parent 7e9318e commit 2a0e283
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
7 changes: 5 additions & 2 deletions src/routes/workspace/editor/tiptap/Tiptap.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import { activeFile } from '../../../store';
import { fileStore, type FileInfo } from '@/api/apiStore';
import { editor } from '../editorStore';
import MetaSettings from './extensions/MetaSettings.svelte';
import { MetaSettingsExtension } from './extensions/MetaSettingsExtension';
let state: AuthorizerState;
Expand Down Expand Up @@ -82,7 +84,7 @@
document: provider.document
}),
Document.extend({
content: 'title block+'
content: 'metaSettings title block+'
}),
TableOfContents,
Title,
Expand All @@ -95,7 +97,8 @@
return '';
},
showOnlyCurrent: false
})
}),
MetaSettingsExtension
],
onUpdate: ({ transaction }) => {
// console.log('too', transaction);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,17 @@ import MetaSettings from './MetaSettings.svelte';

export const MetaSettingsExtension = Node.create({
name: 'metaSettings',
group: 'meta-settings',
group: 'block',
atom: true,
draggable: true, // Optional: to make the node draggable
inline: false,

selectable: false,
// draggable: true, // Optional: to make the node draggable
// inline: false,
// isolating: true,
// allowGapCursor: true,
onTransaction: function ({ transaction }) {
console.log(transaction.curSelection.$anchor.path[1]);
},

parseHTML() {
return [{ tag: 'meta-settings-component' }];
Expand Down
2 changes: 1 addition & 1 deletion src/routes/workspace/tiptap-test/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { Editor, EditorContent, createEditor } from 'svelte-tiptap';
import Document from '@tiptap/extension-document';
import { EditorExtensions } from '@/editor/extensions';
import { MetaSettingsExtension } from '../editor/tiptap/extensions/MetaSettings';
import { MetaSettingsExtension } from '../editor/tiptap/extensions/MetaSettingsExtension';
let editor: Readable<Editor>;
Expand Down

0 comments on commit 2a0e283

Please sign in to comment.