@threadlabs/looma 0.15.5 → 0.15.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -9065,6 +9065,12 @@ function setActiveTableCellBackground(editor, backgroundColor) {
|
|
|
9065
9065
|
* Default Tiptap extension preset for Looma editor.
|
|
9066
9066
|
* Uses the Vanilla JS Tiptap API; apps provide @tiptap/core and Looma ships the preset extensions.
|
|
9067
9067
|
*/
|
|
9068
|
+
var StoredOnlyHighlight = Highlight.extend({
|
|
9069
|
+
parseHTML: () => [],
|
|
9070
|
+
addKeyboardShortcuts: () => ({}),
|
|
9071
|
+
addInputRules: () => [],
|
|
9072
|
+
addPasteRules: () => []
|
|
9073
|
+
});
|
|
9068
9074
|
var lowlight = createLowlight(common);
|
|
9069
9075
|
/**
|
|
9070
9076
|
* Complete Looma table schema as one Tiptap extension.
|
|
@@ -9105,7 +9111,7 @@ function getLoomaTableExtensions() {
|
|
|
9105
9111
|
* framework's Tiptap editor hook.
|
|
9106
9112
|
*/
|
|
9107
9113
|
function getDefaultEditorExtensions(options = {}) {
|
|
9108
|
-
const { placeholder = "Type “/” for commands, or start writing…", linkOpenOnClick = false, imageInline = false, mention = createLoomaMentionExtension() } = options;
|
|
9114
|
+
const { placeholder = "Type “/” for commands, or start writing…", linkOpenOnClick = false, imageInline = false, mention = createLoomaMentionExtension(), disableHighlight = false } = options;
|
|
9109
9115
|
return [
|
|
9110
9116
|
Document,
|
|
9111
9117
|
Paragraph,
|
|
@@ -9139,7 +9145,7 @@ function getDefaultEditorExtensions(options = {}) {
|
|
|
9139
9145
|
}
|
|
9140
9146
|
}),
|
|
9141
9147
|
Image.configure({ inline: imageInline }),
|
|
9142
|
-
Highlight.configure({ multicolor: false }),
|
|
9148
|
+
(disableHighlight ? StoredOnlyHighlight : Highlight).configure({ multicolor: false }),
|
|
9143
9149
|
Code,
|
|
9144
9150
|
LoomaSmartPaste,
|
|
9145
9151
|
CodeBlockLowlight.configure({ lowlight }),
|
|
@@ -17,6 +17,13 @@ export interface DefaultEditorExtensionsOptions {
|
|
|
17
17
|
imageInline?: boolean;
|
|
18
18
|
/** Custom mention extension, the Looma default, or false to omit mentions. */
|
|
19
19
|
mention?: AnyExtension | false;
|
|
20
|
+
/**
|
|
21
|
+
* Removes every way for authors to apply the highlight mark: the Mod-Shift-H
|
|
22
|
+
* shortcut, `==text==` typing and paste rules, and `<mark>` parsing from
|
|
23
|
+
* pasted or HTML content. Highlights already stored in a document still load
|
|
24
|
+
* and render. Use it when the application reserves highlighting for itself.
|
|
25
|
+
*/
|
|
26
|
+
disableHighlight?: boolean;
|
|
20
27
|
}
|
|
21
28
|
/**
|
|
22
29
|
* Complete Looma table schema as one Tiptap extension.
|
package/package.json
CHANGED
|
@@ -94,6 +94,14 @@ export declare const LoomaEditor: import("vue").DefineComponent<import("vue").Ex
|
|
|
94
94
|
type: PropType<LoomaEditorToolbarMode>;
|
|
95
95
|
default: string;
|
|
96
96
|
};
|
|
97
|
+
/**
|
|
98
|
+
* Authors can't highlight: no toolbar button, shortcut, `==text==` rule, or `<mark>` paste.
|
|
99
|
+
* Highlights already in the document still show. Read once, when the editor is created.
|
|
100
|
+
*/
|
|
101
|
+
disableHighlight: {
|
|
102
|
+
type: BooleanConstructor;
|
|
103
|
+
default: boolean;
|
|
104
|
+
};
|
|
97
105
|
}>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
98
106
|
[key: string]: any;
|
|
99
107
|
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
@@ -160,6 +168,14 @@ export declare const LoomaEditor: import("vue").DefineComponent<import("vue").Ex
|
|
|
160
168
|
type: PropType<LoomaEditorToolbarMode>;
|
|
161
169
|
default: string;
|
|
162
170
|
};
|
|
171
|
+
/**
|
|
172
|
+
* Authors can't highlight: no toolbar button, shortcut, `==text==` rule, or `<mark>` paste.
|
|
173
|
+
* Highlights already in the document still show. Read once, when the editor is created.
|
|
174
|
+
*/
|
|
175
|
+
disableHighlight: {
|
|
176
|
+
type: BooleanConstructor;
|
|
177
|
+
default: boolean;
|
|
178
|
+
};
|
|
163
179
|
}>> & Readonly<{
|
|
164
180
|
"onUpdate:modelValue"?: ((_value: JSONContent) => any) | undefined;
|
|
165
181
|
onUpdate?: ((_value: JSONContent) => any) | undefined;
|
|
@@ -170,6 +186,7 @@ export declare const LoomaEditor: import("vue").DefineComponent<import("vue").Ex
|
|
|
170
186
|
}>, {
|
|
171
187
|
label: string;
|
|
172
188
|
placeholder: string;
|
|
189
|
+
disableHighlight: boolean;
|
|
173
190
|
modelValue: JSONContent;
|
|
174
191
|
editable: boolean;
|
|
175
192
|
extensions: AnyExtension[];
|
package/vue/editor/index.js
CHANGED
|
@@ -322,6 +322,14 @@ var LoomaEditor = defineComponent({
|
|
|
322
322
|
toolbarMode: {
|
|
323
323
|
type: String,
|
|
324
324
|
default: "bubble"
|
|
325
|
+
},
|
|
326
|
+
/**
|
|
327
|
+
* Authors can't highlight: no toolbar button, shortcut, `==text==` rule, or `<mark>` paste.
|
|
328
|
+
* Highlights already in the document still show. Read once, when the editor is created.
|
|
329
|
+
*/
|
|
330
|
+
disableHighlight: {
|
|
331
|
+
type: Boolean,
|
|
332
|
+
default: false
|
|
325
333
|
}
|
|
326
334
|
},
|
|
327
335
|
emits: {
|
|
@@ -457,11 +465,13 @@ var LoomaEditor = defineComponent({
|
|
|
457
465
|
text: selection instanceof TextSelection
|
|
458
466
|
};
|
|
459
467
|
};
|
|
468
|
+
const authorHighlight = !props.disableHighlight;
|
|
460
469
|
const editor = useEditor({
|
|
461
470
|
extensions: [
|
|
462
471
|
...getDefaultEditorExtensions({
|
|
463
472
|
placeholder: props.placeholder,
|
|
464
|
-
mention: mentionExtension ?? false
|
|
473
|
+
mention: mentionExtension ?? false,
|
|
474
|
+
disableHighlight: props.disableHighlight
|
|
465
475
|
}),
|
|
466
476
|
imageDelivery.extension,
|
|
467
477
|
slashExtension,
|
|
@@ -997,7 +1007,7 @@ var LoomaEditor = defineComponent({
|
|
|
997
1007
|
commandButton("Italic", "italic", instance.isActive("italic"), !instance.can().toggleItalic(), () => instance.chain().focus().toggleItalic().run()),
|
|
998
1008
|
commandButton("Underline", "underline", instance.isActive("underline"), !instance.can().toggleUnderline(), () => instance.chain().focus().toggleUnderline().run()),
|
|
999
1009
|
commandButton("Strike", "strikethrough", instance.isActive("strike"), !instance.can().toggleStrike(), () => instance.chain().focus().toggleStrike().run()),
|
|
1000
|
-
commandButton("Highlight", "highlighter", instance.isActive("highlight"), !instance.can().toggleHighlight(), () => instance.chain().focus().toggleHighlight().run()),
|
|
1010
|
+
...authorHighlight ? [commandButton("Highlight", "highlighter", instance.isActive("highlight"), !instance.can().toggleHighlight(), () => instance.chain().focus().toggleHighlight().run())] : [],
|
|
1001
1011
|
commandButton("Inline code", "code-xml", instance.isActive("code"), !instance.can().toggleCode(), () => instance.chain().focus().toggleCode().run()),
|
|
1002
1012
|
h(IconButton, {
|
|
1003
1013
|
id: linkAnchorId,
|