refac
This commit is contained in:
Generated
+4436
-3045
File diff suppressed because it is too large
Load Diff
+3
-3
@@ -43,7 +43,7 @@
|
|||||||
"sass-embedded": "^1.81.0",
|
"sass-embedded": "^1.81.0",
|
||||||
"svelte": "^5.53.10",
|
"svelte": "^5.53.10",
|
||||||
"svelte-check": "^4.0.0",
|
"svelte-check": "^4.0.0",
|
||||||
"svelte-confetti": "^1.3.2",
|
"svelte-confetti": "^2.3.2",
|
||||||
"tailwindcss": "^4.0.0",
|
"tailwindcss": "^4.0.0",
|
||||||
"tslib": "^2.4.1",
|
"tslib": "^2.4.1",
|
||||||
"typescript": "^5.5.4",
|
"typescript": "^5.5.4",
|
||||||
@@ -65,12 +65,12 @@
|
|||||||
"@sveltejs/adapter-node": "^2.0.0",
|
"@sveltejs/adapter-node": "^2.0.0",
|
||||||
"@sveltejs/svelte-virtual-list": "^3.0.1",
|
"@sveltejs/svelte-virtual-list": "^3.0.1",
|
||||||
"@tiptap/core": "^3.0.7",
|
"@tiptap/core": "^3.0.7",
|
||||||
"@tiptap/extension-bubble-menu": "^2.26.1",
|
"@tiptap/extension-bubble-menu": "^3.0.7",
|
||||||
"@tiptap/extension-code": "^3.0.7",
|
"@tiptap/extension-code": "^3.0.7",
|
||||||
"@tiptap/extension-code-block-lowlight": "^3.0.7",
|
"@tiptap/extension-code-block-lowlight": "^3.0.7",
|
||||||
"@tiptap/extension-drag-handle": "^3.4.5",
|
"@tiptap/extension-drag-handle": "^3.4.5",
|
||||||
"@tiptap/extension-file-handler": "^3.0.7",
|
"@tiptap/extension-file-handler": "^3.0.7",
|
||||||
"@tiptap/extension-floating-menu": "^2.26.1",
|
"@tiptap/extension-floating-menu": "^3.0.7",
|
||||||
"@tiptap/extension-highlight": "^3.3.0",
|
"@tiptap/extension-highlight": "^3.3.0",
|
||||||
"@tiptap/extension-image": "^3.0.7",
|
"@tiptap/extension-image": "^3.0.7",
|
||||||
"@tiptap/extension-link": "^3.0.7",
|
"@tiptap/extension-link": "^3.0.7",
|
||||||
|
|||||||
@@ -790,12 +790,11 @@
|
|||||||
? [
|
? [
|
||||||
BubbleMenu.configure({
|
BubbleMenu.configure({
|
||||||
element: bubbleMenuElement,
|
element: bubbleMenuElement,
|
||||||
tippyOptions: {
|
appendTo: () => document.body,
|
||||||
duration: 100,
|
options: {
|
||||||
arrow: false,
|
strategy: 'fixed',
|
||||||
placement: 'top',
|
placement: 'top',
|
||||||
theme: 'transparent',
|
offset: 2
|
||||||
offset: [0, 2]
|
|
||||||
},
|
},
|
||||||
shouldShow: ({ editor, view, state, oldState, from, to }) => {
|
shouldShow: ({ editor, view, state, oldState, from, to }) => {
|
||||||
// safety check
|
// safety check
|
||||||
@@ -808,20 +807,34 @@
|
|||||||
}),
|
}),
|
||||||
FloatingMenu.configure({
|
FloatingMenu.configure({
|
||||||
element: floatingMenuElement,
|
element: floatingMenuElement,
|
||||||
tippyOptions: {
|
appendTo: () => document.body,
|
||||||
duration: 100,
|
options: {
|
||||||
arrow: false,
|
strategy: 'fixed',
|
||||||
placement: floatingMenuPlacement,
|
placement: floatingMenuPlacement,
|
||||||
theme: 'transparent',
|
offset: 4
|
||||||
offset: [-12, 4]
|
|
||||||
},
|
},
|
||||||
shouldShow: ({ editor, view, state, oldState }) => {
|
shouldShow: ({ editor, view, state, oldState }) => {
|
||||||
// safety check
|
// safety check
|
||||||
if (!editor || !editor.view || editor.isDestroyed) {
|
if (!editor || !editor.view || editor.isDestroyed) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// default logic
|
const { selection } = state;
|
||||||
return editor.isActive('paragraph');
|
const { $anchor, empty } = selection;
|
||||||
|
const isRootDepth = $anchor.depth === 1;
|
||||||
|
const isEmptyTextBlock =
|
||||||
|
$anchor.parent.isTextblock &&
|
||||||
|
!$anchor.parent.type.spec.code &&
|
||||||
|
!$anchor.parent.textContent &&
|
||||||
|
$anchor.parent.childCount === 0;
|
||||||
|
|
||||||
|
// Only show on empty paragraphs at root depth
|
||||||
|
return (
|
||||||
|
view.hasFocus() &&
|
||||||
|
empty &&
|
||||||
|
isRootDepth &&
|
||||||
|
isEmptyTextBlock &&
|
||||||
|
editor.isEditable
|
||||||
|
);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
@@ -1232,11 +1245,11 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if richText && showFormattingToolbar}
|
{#if richText && showFormattingToolbar}
|
||||||
<div bind:this={bubbleMenuElement} id="bubble-menu" class="p-0 {editor ? '' : 'hidden'}">
|
<div bind:this={bubbleMenuElement} id="bubble-menu" class="p-0" style="visibility: hidden; opacity: 0; position: absolute; z-index: 9999;">
|
||||||
<FormattingButtons {editor} />
|
<FormattingButtons {editor} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div bind:this={floatingMenuElement} id="floating-menu" class="p-0 {editor ? '' : 'hidden'}">
|
<div bind:this={floatingMenuElement} id="floating-menu" class="p-0" style="visibility: hidden; opacity: 0; position: absolute; z-index: 9999;">
|
||||||
<FormattingButtons {editor} />
|
<FormattingButtons {editor} />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
Reference in New Issue
Block a user