@zipify/wysiwyg 1.0.0-dev.73 → 1.0.0-dev.74
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.
- package/dist/wysiwyg.mjs +58 -1
- package/lib/extensions/core/index.js +5 -1
- package/package.json +2 -1
package/dist/wysiwyg.mjs
CHANGED
|
@@ -25537,6 +25537,60 @@ const History = Extension.create({
|
|
|
25537
25537
|
};
|
|
25538
25538
|
}
|
|
25539
25539
|
});
|
|
25540
|
+
const HardBreak = Node$1.create({
|
|
25541
|
+
name: "hardBreak",
|
|
25542
|
+
addOptions() {
|
|
25543
|
+
return {
|
|
25544
|
+
keepMarks: true,
|
|
25545
|
+
HTMLAttributes: {}
|
|
25546
|
+
};
|
|
25547
|
+
},
|
|
25548
|
+
inline: true,
|
|
25549
|
+
group: "inline",
|
|
25550
|
+
selectable: false,
|
|
25551
|
+
parseHTML() {
|
|
25552
|
+
return [
|
|
25553
|
+
{ tag: "br" }
|
|
25554
|
+
];
|
|
25555
|
+
},
|
|
25556
|
+
renderHTML({ HTMLAttributes }) {
|
|
25557
|
+
return ["br", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
|
|
25558
|
+
},
|
|
25559
|
+
renderText() {
|
|
25560
|
+
return "\n";
|
|
25561
|
+
},
|
|
25562
|
+
addCommands() {
|
|
25563
|
+
return {
|
|
25564
|
+
setHardBreak: () => ({ commands: commands2, chain, state, editor }) => {
|
|
25565
|
+
return commands2.first([
|
|
25566
|
+
() => commands2.exitCode(),
|
|
25567
|
+
() => commands2.command(() => {
|
|
25568
|
+
const { selection, storedMarks } = state;
|
|
25569
|
+
if (selection.$from.parent.type.spec.isolating) {
|
|
25570
|
+
return false;
|
|
25571
|
+
}
|
|
25572
|
+
const { keepMarks } = this.options;
|
|
25573
|
+
const { splittableMarks } = editor.extensionManager;
|
|
25574
|
+
const marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();
|
|
25575
|
+
return chain().insertContent({ type: this.name }).command(({ tr, dispatch }) => {
|
|
25576
|
+
if (dispatch && marks && keepMarks) {
|
|
25577
|
+
const filteredMarks = marks.filter((mark) => splittableMarks.includes(mark.type.name));
|
|
25578
|
+
tr.ensureMarks(filteredMarks);
|
|
25579
|
+
}
|
|
25580
|
+
return true;
|
|
25581
|
+
}).run();
|
|
25582
|
+
})
|
|
25583
|
+
]);
|
|
25584
|
+
}
|
|
25585
|
+
};
|
|
25586
|
+
},
|
|
25587
|
+
addKeyboardShortcuts() {
|
|
25588
|
+
return {
|
|
25589
|
+
"Mod-Enter": () => this.editor.commands.setHardBreak(),
|
|
25590
|
+
"Shift-Enter": () => this.editor.commands.setHardBreak()
|
|
25591
|
+
};
|
|
25592
|
+
}
|
|
25593
|
+
});
|
|
25540
25594
|
const NodeProcessor = Extension.create({
|
|
25541
25595
|
name: "node_processor",
|
|
25542
25596
|
addCommands() {
|
|
@@ -25686,12 +25740,15 @@ const buildCoreExtensions = () => [
|
|
|
25686
25740
|
Paragraph.configure({
|
|
25687
25741
|
HTMLAttributes: { class: "zw-style" }
|
|
25688
25742
|
}),
|
|
25689
|
-
Text,
|
|
25690
25743
|
Placeholder.configure({
|
|
25691
25744
|
placeholder: "Type your text here...",
|
|
25692
25745
|
emptyNodeClass: "zw-wysiwyg__placeholder"
|
|
25693
25746
|
}),
|
|
25747
|
+
Text,
|
|
25694
25748
|
History,
|
|
25749
|
+
HardBreak.configure({
|
|
25750
|
+
keepMarks: false
|
|
25751
|
+
}),
|
|
25695
25752
|
NodeProcessor,
|
|
25696
25753
|
TextProcessor,
|
|
25697
25754
|
SelectionProcessor,
|
|
@@ -3,6 +3,7 @@ import Paragraph from '@tiptap/extension-paragraph';
|
|
|
3
3
|
import Text from '@tiptap/extension-text';
|
|
4
4
|
import Placeholder from '@tiptap/extension-placeholder';
|
|
5
5
|
import History from '@tiptap/extension-history';
|
|
6
|
+
import HardBreak from '@tiptap/extension-hard-break';
|
|
6
7
|
import { NodeProcessor } from './NodeProcessor';
|
|
7
8
|
import { TextProcessor } from './TextProcessor';
|
|
8
9
|
import { SelectionProcessor } from './SelectionProcessor';
|
|
@@ -13,12 +14,15 @@ export const buildCoreExtensions = () => [
|
|
|
13
14
|
Paragraph.configure({
|
|
14
15
|
HTMLAttributes: { class: 'zw-style' }
|
|
15
16
|
}),
|
|
16
|
-
Text,
|
|
17
17
|
Placeholder.configure({
|
|
18
18
|
placeholder: 'Type your text here...',
|
|
19
19
|
emptyNodeClass: 'zw-wysiwyg__placeholder'
|
|
20
20
|
}),
|
|
21
|
+
Text,
|
|
21
22
|
History,
|
|
23
|
+
HardBreak.configure({
|
|
24
|
+
keepMarks: false
|
|
25
|
+
}),
|
|
22
26
|
NodeProcessor,
|
|
23
27
|
TextProcessor,
|
|
24
28
|
SelectionProcessor,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zipify/wysiwyg",
|
|
3
|
-
"version": "1.0.0-dev.
|
|
3
|
+
"version": "1.0.0-dev.74",
|
|
4
4
|
"description": "Zipify modification of TipTap text editor",
|
|
5
5
|
"main": "dist/wysiwyg.mjs",
|
|
6
6
|
"repository": {
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"@popperjs/core": "^2.11.5",
|
|
31
31
|
"@tiptap/core": "^2.0.0-beta.182",
|
|
32
32
|
"@tiptap/extension-document": "^2.0.0-beta.17",
|
|
33
|
+
"@tiptap/extension-hard-break": "^2.0.0-beta.33",
|
|
33
34
|
"@tiptap/extension-heading": "^2.0.0-beta.29",
|
|
34
35
|
"@tiptap/extension-history": "^2.0.0-beta.26",
|
|
35
36
|
"@tiptap/extension-link": "^2.0.0-beta.43",
|