@zipify/wysiwyg 1.0.0-dev.70 → 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.css CHANGED
@@ -23,7 +23,7 @@
23
23
  column-gap: var(--zw-offset-xxs);
24
24
  }
25
25
 
26
- .zw-button[data-v-86a41806] {
26
+ .zw-button[data-v-562f4e4a] {
27
27
  display: inline-flex;
28
28
  align-items: center;
29
29
  vertical-align: middle;
@@ -33,6 +33,7 @@
33
33
  background-color: transparent;
34
34
  border: 0;
35
35
  padding: 0;
36
+ margin: 0;
36
37
  white-space: nowrap;
37
38
  appearance: none;
38
39
  user-select: none;
@@ -42,21 +43,21 @@
42
43
  transition: 0.1s opacity ease-out;
43
44
  will-change: opacity;
44
45
  }
45
- .zw-button[data-v-86a41806]::-moz-focus-inner {
46
+ .zw-button[data-v-562f4e4a]::-moz-focus-inner {
46
47
  border: 0 !important;
47
48
  }
48
- .zw-button[data-v-86a41806]:hover,
49
- .zw-button[data-v-86a41806]:focus {
49
+ .zw-button[data-v-562f4e4a]:hover,
50
+ .zw-button[data-v-562f4e4a]:focus {
50
51
  text-decoration: none;
51
52
  outline: none;
52
53
  }
53
- .zw-button[data-v-86a41806]:disabled {
54
+ .zw-button[data-v-562f4e4a]:disabled {
54
55
  user-select: none;
55
56
  box-shadow: none;
56
57
  cursor: not-allowed;
57
58
  opacity: 0.35;
58
59
  }
59
- .zw-button--toolbar[data-v-86a41806] {
60
+ .zw-button--toolbar[data-v-562f4e4a] {
60
61
  border-radius: 1px;
61
62
  min-height: 28px;
62
63
  font-weight: var(--zw-font-weight-semibold);
@@ -66,29 +67,29 @@
66
67
  transition-property: background-color, color, opacity;
67
68
  will-change: background-color, color, opacity;
68
69
  }
69
- .zw-button--primary[data-v-86a41806] {
70
+ .zw-button--primary[data-v-562f4e4a] {
70
71
  background-color: rgb(var(--zw-color-green));
71
72
  color: rgb(var(--zw-color-white));
72
73
  padding: var(--zw-offset-xxs) var(--zw-offset-sm);
73
74
  line-height: var(--zw-line-height-md);
74
75
  }
75
- .zw-button--primary[data-v-86a41806],
76
- .zw-button--secondary[data-v-86a41806] {
76
+ .zw-button--primary[data-v-562f4e4a],
77
+ .zw-button--secondary[data-v-562f4e4a] {
77
78
  color: rgb(var(--zw-color-white));
78
79
  padding: var(--zw-offset-xxs) var(--zw-offset-sm);
79
80
  font-weight: 600;
80
81
  font-size: var(--zw-font-size-xs);
81
82
  }
82
- .zw-button--primary[data-v-86a41806]:not(:disabled):hover,
83
- .zw-button--secondary[data-v-86a41806]:not(:disabled):hover {
83
+ .zw-button--primary[data-v-562f4e4a]:not(:disabled):hover,
84
+ .zw-button--secondary[data-v-562f4e4a]:not(:disabled):hover {
84
85
  opacity: 0.9;
85
86
  }
86
- .zw-button--toolbar[data-v-86a41806]:not(.zw-button--icon) {
87
+ .zw-button--toolbar[data-v-562f4e4a]:not(.zw-button--icon) {
87
88
  padding: var(--zw-offset-xxs) var(--zw-offset-xs);
88
89
  }
89
- .zw-button--toolbar[data-v-86a41806]:not(:disabled):hover,
90
- .zw-button--toolbar[data-v-86a41806]:not(:disabled):focus,
91
- .zw-button--toolbar.zw-button--active[data-v-86a41806]:not(:disabled) {
90
+ .zw-button--toolbar[data-v-562f4e4a]:not(:disabled):hover,
91
+ .zw-button--toolbar[data-v-562f4e4a]:not(:disabled):focus,
92
+ .zw-button--toolbar.zw-button--active[data-v-562f4e4a]:not(:disabled) {
92
93
  color: rgb(var(--zw-color-white));
93
94
  background-color: rgb(var(--zw-color-n5));
94
95
  }
package/dist/wysiwyg.mjs CHANGED
@@ -14238,7 +14238,7 @@ var __component__$G = /* @__PURE__ */ normalizeComponent(
14238
14238
  staticRenderFns$G,
14239
14239
  false,
14240
14240
  __vue2_injectStyles$G,
14241
- "86a41806",
14241
+ "562f4e4a",
14242
14242
  null,
14243
14243
  null
14244
14244
  );
@@ -22811,7 +22811,7 @@ function useToolbar({ wrapperRef, offsets, isActiveRef }) {
22811
22811
  },
22812
22812
  {
22813
22813
  name: "flip",
22814
- enabled: false
22814
+ options: { rootBoundary: "document" }
22815
22815
  }
22816
22816
  ]
22817
22817
  });
@@ -23220,7 +23220,8 @@ const FontSize = Mark.create({
23220
23220
  const parseSize = (value) => {
23221
23221
  if (!value)
23222
23222
  return null;
23223
- const converted = convertFontSize(value, this.options.wrapperRef.value);
23223
+ const wrapperEl = this.options.wrapperRef.value || this.options.wrapperRef;
23224
+ const converted = convertFontSize(value, wrapperEl);
23224
23225
  return String(converted);
23225
23226
  };
23226
23227
  return [
@@ -23632,7 +23633,8 @@ const LineHeight = Extension.create({
23632
23633
  const value = element.style.lineHeight;
23633
23634
  if (!value)
23634
23635
  return null;
23635
- const converted = convertLineHeight(value, element, this.options.wrapperRef.value);
23636
+ const wrapperEl = this.options.wrapperRef.value || this.options.wrapperRef;
23637
+ const converted = convertLineHeight(value, element, wrapperEl);
23636
23638
  return { desktop: converted, tablet: converted, mobile: converted };
23637
23639
  },
23638
23640
  renderHTML(attrs) {
@@ -25535,6 +25537,60 @@ const History = Extension.create({
25535
25537
  };
25536
25538
  }
25537
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
+ });
25538
25594
  const NodeProcessor = Extension.create({
25539
25595
  name: "node_processor",
25540
25596
  addCommands() {
@@ -25684,12 +25740,15 @@ const buildCoreExtensions = () => [
25684
25740
  Paragraph.configure({
25685
25741
  HTMLAttributes: { class: "zw-style" }
25686
25742
  }),
25687
- Text,
25688
25743
  Placeholder.configure({
25689
25744
  placeholder: "Type your text here...",
25690
25745
  emptyNodeClass: "zw-wysiwyg__placeholder"
25691
25746
  }),
25747
+ Text,
25692
25748
  History,
25749
+ HardBreak.configure({
25750
+ keepMarks: false
25751
+ }),
25693
25752
  NodeProcessor,
25694
25753
  TextProcessor,
25695
25754
  SelectionProcessor,
@@ -66,6 +66,7 @@ export default {
66
66
  background-color: transparent;
67
67
  border: 0;
68
68
  padding: 0;
69
+ margin: 0;
69
70
  white-space: nowrap;
70
71
  appearance: none;
71
72
  user-select: none;
@@ -22,7 +22,7 @@ export function useToolbar({ wrapperRef, offsets, isActiveRef }) {
22
22
  },
23
23
  {
24
24
  name: 'flip',
25
- enabled: false
25
+ options: { rootBoundary: 'document' }
26
26
  }
27
27
  ]
28
28
  });
@@ -66,7 +66,8 @@ export const FontSize = Mark.create({
66
66
  const parseSize = (value) => {
67
67
  if (!value) return null;
68
68
 
69
- const converted = convertFontSize(value, this.options.wrapperRef.value);
69
+ const wrapperEl = this.options.wrapperRef.value || this.options.wrapperRef;
70
+ const converted = convertFontSize(value, wrapperEl);
70
71
 
71
72
  return String(converted);
72
73
  };
@@ -33,7 +33,8 @@ export const LineHeight = Extension.create({
33
33
 
34
34
  if (!value) return null;
35
35
 
36
- const converted = convertLineHeight(value, element, this.options.wrapperRef.value);
36
+ const wrapperEl = this.options.wrapperRef.value || this.options.wrapperRef;
37
+ const converted = convertLineHeight(value, element, wrapperEl);
37
38
 
38
39
  return { desktop: converted, tablet: converted, mobile: converted };
39
40
  },
@@ -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.70",
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",