@zipify/wysiwyg 2.4.3 → 2.4.4-1

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.
Files changed (28) hide show
  1. package/dist/cli.js +2 -2
  2. package/dist/wysiwyg.css +2 -2
  3. package/dist/wysiwyg.mjs +2742 -2691
  4. package/lib/components/toolbar/controls/AlignmentDeviceControl.vue +15 -4
  5. package/lib/components/toolbar/controls/link/composables/__tests__/useLink.test.js +1 -0
  6. package/lib/components/toolbar/controls/link/composables/useLink.js +7 -7
  7. package/lib/extensions/Alignment.js +2 -5
  8. package/lib/extensions/FontSize.js +24 -6
  9. package/lib/extensions/LineHeight.js +2 -8
  10. package/lib/extensions/Link.js +12 -11
  11. package/lib/extensions/__tests__/Link.test.js +67 -11
  12. package/lib/extensions/__tests__/__snapshots__/Alignment.test.js.snap +4 -4
  13. package/lib/extensions/__tests__/__snapshots__/FontSize.test.js.snap +5 -5
  14. package/lib/extensions/__tests__/__snapshots__/LineHeight.test.js.snap +1 -1
  15. package/lib/extensions/__tests__/__snapshots__/Link.test.js.snap +33 -0
  16. package/lib/extensions/core/NodeProcessor.js +17 -3
  17. package/lib/extensions/core/SelectionProcessor.js +14 -8
  18. package/lib/extensions/core/__tests__/NodeProcessor.test.js +26 -0
  19. package/lib/extensions/core/__tests__/SelectionProcessor.test.js +16 -2
  20. package/lib/extensions/core/index.js +2 -0
  21. package/lib/services/NodeFactory.js +1 -4
  22. package/lib/services/__tests__/__snapshots__/NodeFactory.test.js.snap +1 -1
  23. package/lib/utils/__tests__/isMarkAppliedToParent.test.js +5 -5
  24. package/lib/utils/index.js +1 -0
  25. package/lib/utils/isMarkAppliedToParent.js +7 -2
  26. package/lib/utils/isNodeFullySelected.js +3 -1
  27. package/lib/utils/resolvePositionOffset.js +3 -0
  28. package/package.json +1 -1
@@ -7,7 +7,7 @@
7
7
  @click="toggler.open"
8
8
  v-tooltip="'Alignment'"
9
9
  >
10
- <Icon :name="`alignment-${currentValue}`" size="28px" auto-color />
10
+ <Icon :name="icon" size="28px" auto-color />
11
11
  </Button>
12
12
 
13
13
  <Modal class="zw-alignment-control__modal" ref="modalRef" :toggler="toggler">
@@ -17,10 +17,11 @@
17
17
  </template>
18
18
 
19
19
  <script>
20
- import { inject, ref } from 'vue';
20
+ import { computed, inject, ref, unref } from 'vue';
21
21
  import { InjectionTokens } from '../../../injectionTokens';
22
- import { Button, Icon, Modal, useModalToggler } from '../../base';
23
22
  import { tooltip } from '../../../directives';
23
+ import { Alignments } from '../../../enums';
24
+ import { Button, Icon, Modal, useModalToggler } from '../../base';
24
25
  import AlignmentControl from './AlignmentControl';
25
26
 
26
27
  export default {
@@ -43,12 +44,22 @@ export default {
43
44
  const wrapperRef = ref(null);
44
45
  const modalRef = ref(null);
45
46
 
46
- const toggler = useModalToggler({ wrapperRef, modalRef });
47
+ const toggler = useModalToggler({
48
+ wrapperRef,
49
+ modalRef
50
+ });
51
+
52
+ const icon = computed(() => {
53
+ const name = unref(currentValue) || Alignments.LEFT;
54
+
55
+ return `alignment-${name}`;
56
+ });
47
57
 
48
58
  return {
49
59
  wrapperRef,
50
60
  modalRef,
51
61
  currentValue,
62
+ icon,
52
63
  toggler,
53
64
  isOpened: toggler.isOpened
54
65
  };
@@ -8,6 +8,7 @@ const createEditor = (text, destination) => ({
8
8
  commands: {
9
9
  storeSelection: jest.fn(),
10
10
  restoreSelection: jest.fn(),
11
+ expandSelectionToLink: jest.fn(),
11
12
  getSelectedText: jest.fn(() => text ?? ''),
12
13
  focus: jest.fn().mockReturnThis(),
13
14
  unsetLink: jest.fn().mockReturnThis(),
@@ -16,15 +16,15 @@ export function useLink() {
16
16
  }
17
17
 
18
18
  function prepareInitialFields() {
19
- const link = editor.getAttributes(TextSettings.LINK);
20
-
19
+ editor.commands.expandSelectionToLink();
21
20
  linkData.value.text = editor.commands.getSelectedText();
22
- currentDestination.value.id = link.destination || LinkDestinations.URL;
23
- linkData.value.target = link.target || LinkTargets.SELF;
24
21
 
25
- if (link.href) {
26
- destinationHrefs.value[currentDestination.value.id] = link.href;
27
- }
22
+ const { destination, href, target } = editor.getAttributes(TextSettings.LINK);
23
+
24
+ currentDestination.value.id = destination || LinkDestinations.URL;
25
+ linkData.value.target = target || LinkTargets.SELF;
26
+
27
+ if (href) destinationHrefs.value[currentDestination.value.id] = href;
28
28
  }
29
29
 
30
30
  function resetDestinations() {
@@ -59,12 +59,9 @@ export const Alignment = Extension.create({
59
59
  }),
60
60
 
61
61
  applyAlignment: createCommand(({ commands }, value) => {
62
- // const device = unref(commands.getDevice());
63
- //
64
- // commands.setBlockAttributes(this.name, { [device]: value }, DEFAULTS);
62
+ const device = unref(commands.getDevice());
65
63
 
66
- // Temporary until release BUILDER_MODES
67
- commands.setBlockAttributes(this.name, { desktop: value, tablet: value, mobile: value });
64
+ commands.setBlockAttributes(this.name, { [device]: value }, DEFAULTS);
68
65
  }),
69
66
 
70
67
  removeAlignment: createCommand(({ commands }) => commands.removeBlockAttributes(this.name)),
@@ -2,6 +2,7 @@ import { Mark } from '@tiptap/vue-2';
2
2
  import { computed, unref } from 'vue';
3
3
  import { convertFontSize, createCommand, createKeyboardShortcut, renderMark } from '../utils';
4
4
  import { MarkGroups, TextSettings } from '../enums';
5
+ import { AddNodeMarkStep } from './core';
5
6
 
6
7
  export const FontSize = Mark.create({
7
8
  name: TextSettings.FONT_SIZE,
@@ -34,12 +35,31 @@ export const FontSize = Mark.create({
34
35
  }),
35
36
 
36
37
  applyFontSize: createCommand(({ commands }, value) => {
37
- // const device = unref(commands.getDevice());
38
+ const device = unref(commands.getDevice());
38
39
 
39
- // commands.applyMark(this.name, { [device]: value });
40
+ commands.applyMark(this.name, { [device]: value }, {
41
+ isAppliedToParent: (parentMark, mark) => {
42
+ if (parentMark.type.name !== mark.type.name) return false;
40
43
 
41
- // Temporary until release BUILDER_MODES
42
- commands.applyMark(this.name, { desktop: value, tablet: value, mobile: null });
44
+ return parentMark.attrs[device] === mark.attrs[device];
45
+ },
46
+
47
+ onAppliedToParent: ({ tr, node, position, mark }) => {
48
+ const attrs = { ...mark.attrs, [device]: null };
49
+ const canRemove = !Object.values(attrs).some((value) => !!value);
50
+
51
+ if (canRemove) return false;
52
+
53
+ const updated = mark.type.create(attrs);
54
+
55
+ if (node.isText) {
56
+ tr.addMark(position, position + node.nodeSize, updated);
57
+ return;
58
+ }
59
+
60
+ tr.step(new AddNodeMarkStep(position, updated));
61
+ }
62
+ });
43
63
  }),
44
64
 
45
65
  increaseFontSize: createCommand(({ commands }) => {
@@ -89,8 +109,6 @@ export const FontSize = Mark.create({
89
109
  getAttrs: (input) => {
90
110
  const value = parseSize(input);
91
111
 
92
- // return { desktop: value, tablet: value, mobile: value };
93
- // Temporary until release BUILDER_MODES
94
112
  return { desktop: value, tablet: value, mobile: null };
95
113
  }
96
114
  }
@@ -36,9 +36,6 @@ export const LineHeight = Extension.create({
36
36
  const wrapperEl = unref(this.options.wrapperRef);
37
37
  const converted = convertLineHeight(value, element, wrapperEl);
38
38
 
39
- // return { desktop: converted, tablet: converted, mobile: converted };
40
-
41
- // Temporary until release BUILDER_MODES
42
39
  return { desktop: converted, tablet: converted, mobile: null };
43
40
  },
44
41
 
@@ -75,12 +72,9 @@ export const LineHeight = Extension.create({
75
72
  }),
76
73
 
77
74
  applyLineHeight: createCommand(({ commands }, value) => {
78
- // const device = unref(commands.getDevice());
79
- //
80
- // commands.setBlockAttributes(this.name, { [device]: value }, DEFAULTS);
75
+ const device = unref(commands.getDevice());
81
76
 
82
- // Temporary until release BUILDER_MODES
83
- commands.setBlockAttributes(this.name, { desktop: value, tablet: value, mobile: null }, DEFAULTS);
77
+ commands.setBlockAttributes(this.name, { [device]: value }, DEFAULTS);
84
78
  })
85
79
  };
86
80
  }
@@ -63,27 +63,28 @@ export const Link = Base.extend({
63
63
 
64
64
  return chain()
65
65
  .applyMark(this.name, attributes)
66
- .transformText(() => attributes.text)
67
- .extendMarkRange(TextSettings.LINK)
66
+ .expandSelectionToLink()
67
+ .command(({ tr }) => {
68
+ tr.insertText(attributes.text, tr.selection.from, tr.selection.to);
69
+ return true;
70
+ })
68
71
  .run();
69
72
  }),
70
73
 
71
- isLink: createCommand(({ editor }) => computed(() => editor.isActive(TextSettings.LINK))),
74
+ expandSelectionToLink: createCommand(({ commands }) => {
75
+ commands.expandSelection(({ node }) => this.type.isInSet(node.marks));
76
+ }),
77
+
78
+ isLink: createCommand(({ commands }) => commands.hasMark(this.name)),
72
79
  getLinkPreset: createCommand(() => computed(() => this.options.preset))
73
80
  };
74
81
  },
75
82
 
76
83
  renderHTML({ HTMLAttributes: attrs }) {
77
84
  const href = attrs.destination === LinkDestinations.BLOCK ? `#${attrs.href}` : attrs.href;
78
-
79
- const presetClass = this.options.basePresetClass + this.options.preset.id;
85
+ const presetClass = unref(this.options.basePresetClass) + unref(this.options.preset).id;
80
86
  const classes = `${presetClass} zw-style`;
81
-
82
- const linkAttrs = {
83
- href,
84
- target: attrs.target,
85
- class: classes
86
- };
87
+ const linkAttrs = { href, target: attrs.target, class: classes };
87
88
 
88
89
  return ['a', linkAttrs, 0];
89
90
  }
@@ -1,8 +1,15 @@
1
1
  import { ref } from 'vue';
2
- import { Editor } from '@tiptap/vue-2';
2
+ import { Editor, Mark } from '@tiptap/vue-2';
3
3
  import { buildTestExtensions } from '../../__tests__/utils';
4
4
  import { ContentNormalizer, NodeFactory } from '../../services';
5
5
  import { Link } from '../Link';
6
+ import { TextSettings } from '../../enums';
7
+
8
+ const MockFontWeight = Mark.create({
9
+ name: TextSettings.FONT_WEIGHT,
10
+ addAttributes: () => ({ value: { required: true } }),
11
+ renderHTML: () => ['span', {}, 0]
12
+ });
6
13
 
7
14
  function createEditor({ content }) {
8
15
  return new Editor({
@@ -13,42 +20,91 @@ function createEditor({ content }) {
13
20
  preset: 'link',
14
21
  baseClass: 'zw ts-',
15
22
  pageBlocks: ref([{ id: 987654 }])
16
- })
23
+ }),
24
+ MockFontWeight
17
25
  ]
18
26
  })
19
27
  });
20
28
  }
21
29
 
22
- const createContent = (text) => NodeFactory.doc([
23
- NodeFactory.paragraph([text])
24
- ]);
25
-
26
- const linkAttributes = (href) => ({
30
+ const createLink = (href) => ({
27
31
  href: href ?? '/test',
28
32
  text: 'Hello world link',
29
33
  target: '_self',
30
34
  destination: 'url'
31
35
  });
32
36
 
37
+ describe('get link', () => {
38
+ test('should check is link active', () => {
39
+ const editor = createEditor({
40
+ content: NodeFactory.doc([
41
+ NodeFactory.paragraph([
42
+ NodeFactory.text('hello world', [
43
+ NodeFactory.mark(TextSettings.LINK, createLink())
44
+ ])
45
+ ])
46
+ ])
47
+ });
48
+
49
+ editor.commands.selectAll();
50
+
51
+ expect(editor.commands.isLink().value).toBe(true);
52
+ });
53
+
54
+ test('should check is link inactive', () => {
55
+ const editor = createEditor({
56
+ content: NodeFactory.doc([
57
+ NodeFactory.paragraph('hello world')
58
+ ])
59
+ });
60
+
61
+ editor.commands.selectAll();
62
+
63
+ expect(editor.commands.isLink().value).toBe(false);
64
+ });
65
+ });
66
+
33
67
  describe('apply link', () => {
34
68
  test('should apply link', () => {
35
69
  const editor = createEditor({
36
- content: createContent(NodeFactory.text('hello world'))
70
+ content: NodeFactory.doc([
71
+ NodeFactory.paragraph('hello world')
72
+ ])
37
73
  });
38
74
 
39
75
  editor.commands.selectAll();
40
- editor.commands.applyLink(linkAttributes());
76
+ editor.commands.applyLink(createLink());
41
77
 
42
78
  expect(editor.getJSON()).toMatchSnapshot();
43
79
  });
44
80
 
45
81
  test('should apply link when no selected text', () => {
46
82
  const editor = createEditor({
47
- content: createContent(NodeFactory.text('Some text'))
83
+ content: NodeFactory.doc([
84
+ NodeFactory.paragraph('Some text')
85
+ ])
48
86
  });
49
87
 
50
88
  editor.commands.setTextSelection(6);
51
- editor.commands.applyLink(linkAttributes());
89
+ editor.commands.applyLink(createLink());
90
+
91
+ expect(editor.getJSON()).toMatchSnapshot();
92
+ });
93
+
94
+ test('should apply link to multiple selected nodes', () => {
95
+ const editor = createEditor({
96
+ content: NodeFactory.doc([
97
+ NodeFactory.paragraph([
98
+ NodeFactory.text('hello', [
99
+ NodeFactory.mark(TextSettings.FONT_WEIGHT, { value: '700' })
100
+ ]),
101
+ NodeFactory.text(' world')
102
+ ])
103
+ ])
104
+ });
105
+
106
+ editor.commands.selectAll();
107
+ editor.commands.applyLink(createLink());
52
108
 
53
109
  expect(editor.getJSON()).toMatchSnapshot();
54
110
  });
@@ -7,8 +7,8 @@ Object {
7
7
  "attrs": Object {
8
8
  "alignment": Object {
9
9
  "desktop": "right",
10
- "mobile": "right",
11
- "tablet": "right",
10
+ "mobile": null,
11
+ "tablet": null,
12
12
  },
13
13
  },
14
14
  "content": Array [
@@ -51,8 +51,8 @@ Object {
51
51
  "attrs": Object {
52
52
  "alignment": Object {
53
53
  "desktop": "right",
54
- "mobile": "right",
55
- "tablet": "right",
54
+ "mobile": null,
55
+ "tablet": null,
56
56
  },
57
57
  },
58
58
  "content": Array [
@@ -15,7 +15,7 @@ Object {
15
15
  "attrs": Object {
16
16
  "desktop": "16",
17
17
  "mobile": null,
18
- "tablet": "16",
18
+ "tablet": null,
19
19
  },
20
20
  "type": "font_size",
21
21
  },
@@ -42,7 +42,7 @@ Object {
42
42
  "attrs": Object {
43
43
  "desktop": "13",
44
44
  "mobile": null,
45
- "tablet": "13",
45
+ "tablet": null,
46
46
  },
47
47
  "type": "font_size",
48
48
  },
@@ -69,7 +69,7 @@ Object {
69
69
  "attrs": Object {
70
70
  "desktop": "15",
71
71
  "mobile": null,
72
- "tablet": "15",
72
+ "tablet": null,
73
73
  },
74
74
  "type": "font_size",
75
75
  },
@@ -96,7 +96,7 @@ Object {
96
96
  "attrs": Object {
97
97
  "desktop": "5",
98
98
  "mobile": null,
99
- "tablet": "5",
99
+ "tablet": null,
100
100
  },
101
101
  "type": "font_size",
102
102
  },
@@ -123,7 +123,7 @@ Object {
123
123
  "attrs": Object {
124
124
  "desktop": "20",
125
125
  "mobile": null,
126
- "tablet": "20",
126
+ "tablet": null,
127
127
  },
128
128
  "type": "font_size",
129
129
  },
@@ -8,7 +8,7 @@ Object {
8
8
  "line_height": Object {
9
9
  "desktop": "1.41",
10
10
  "mobile": null,
11
- "tablet": "1.41",
11
+ "tablet": null,
12
12
  },
13
13
  },
14
14
  "content": Array [
@@ -27,6 +27,39 @@ Object {
27
27
  }
28
28
  `;
29
29
 
30
+ exports[`apply link should apply link to multiple selected nodes 1`] = `
31
+ Object {
32
+ "content": Array [
33
+ Object {
34
+ "content": Array [
35
+ Object {
36
+ "marks": Array [
37
+ Object {
38
+ "attrs": Object {
39
+ "destination": "url",
40
+ "href": "/test",
41
+ "target": "_self",
42
+ },
43
+ "type": "link",
44
+ },
45
+ Object {
46
+ "attrs": Object {
47
+ "value": "700",
48
+ },
49
+ "type": "font_weight",
50
+ },
51
+ ],
52
+ "text": "Hello world link",
53
+ "type": "text",
54
+ },
55
+ ],
56
+ "type": "paragraph",
57
+ },
58
+ ],
59
+ "type": "doc",
60
+ }
61
+ `;
62
+
30
63
  exports[`apply link should apply link when no selected text 1`] = `
31
64
  Object {
32
65
  "content": Array [
@@ -43,7 +43,7 @@ export const NodeProcessor = Extension.create({
43
43
  }
44
44
  }),
45
45
 
46
- applyMark: createCommand(({ state, commands }, name, value) => {
46
+ applyMark: createCommand(({ state, commands }, name, value, customizer = {}) => {
47
47
  const { tr, doc, schema } = state;
48
48
  const { $from, $to } = tr.selection;
49
49
  const markType = getMarkType(name, schema);
@@ -56,6 +56,14 @@ export const NodeProcessor = Extension.create({
56
56
 
57
57
  if ($from.pos === $to.pos) return;
58
58
 
59
+ const onAppliedToParent = (context) => {
60
+ if (!customizer.onAppliedToParent || customizer.onAppliedToParent(context) === false) {
61
+ const { tr, node, position, mark } = context;
62
+
63
+ commands._removeNodeMark({ tr, node, position, mark: mark.type });
64
+ }
65
+ };
66
+
59
67
  doc.nodesBetween($from.pos, $to.pos, (node, position) => {
60
68
  if (node.type.name === NodeTypes.LIST) return;
61
69
 
@@ -63,8 +71,8 @@ export const NodeProcessor = Extension.create({
63
71
  const applyingMark = markType.create({ ...(initialMark?.attrs || {}), ...value });
64
72
  const textPosition = resolveTextPosition($from, $to, node, position);
65
73
 
66
- if (isMarkAppliedToParent(tr.doc, position, applyingMark)) {
67
- return commands._removeNodeMark({ tr, node, position, mark: markType });
74
+ if (isMarkAppliedToParent(tr.doc, position, applyingMark, customizer.isAppliedToParent)) {
75
+ return onAppliedToParent({ tr, node, position, mark: applyingMark });
68
76
  }
69
77
 
70
78
  if (node.isText) {
@@ -102,6 +110,12 @@ export const NodeProcessor = Extension.create({
102
110
  return computed(() => unref(marksRef)[0] ?? null);
103
111
  }),
104
112
 
113
+ hasMark: createCommand(({ commands }, name) => {
114
+ const mark = commands.getMark(name);
115
+
116
+ return computed(() => !!unref(mark));
117
+ }),
118
+
105
119
  getCommonSettingMark: createCommand(({ commands }, name, defaultRef) => {
106
120
  const selectionRef = commands.getMark(name);
107
121
 
@@ -1,5 +1,5 @@
1
1
  import { Extension } from '@tiptap/vue-2';
2
- import { createCommand } from '../../utils';
2
+ import { createCommand, resolvePositionOffset } from '../../utils';
3
3
  import { NodeTypes } from '../../enums';
4
4
 
5
5
  export const SelectionProcessor = Extension.create({
@@ -19,18 +19,24 @@ export const SelectionProcessor = Extension.create({
19
19
  this.storage.selection && commands.setTextSelection(this.storage.selection);
20
20
  }),
21
21
 
22
- expandSelectionToBlock: createCommand(({ state, commands }) => {
23
- let from = state.selection.from;
24
- let to = state.selection.to;
22
+ expandSelection: createCommand(({ tr, commands }, predicate) => {
23
+ let from = tr.selection.from;
24
+ let to = tr.selection.to;
25
25
 
26
- state.doc.nodesBetween(from, to, (node, position, parent) => {
27
- if (parent.type.name !== NodeTypes.DOCUMENT) return;
26
+ tr.doc.nodesBetween(from, to, (node, position, parent) => {
27
+ if (predicate({ node, parent })) {
28
+ const offset = node.isText ? 0 : resolvePositionOffset(tr.doc, position);
28
29
 
29
- from = Math.min(from, position + 1);
30
- to = Math.max(to, position + node.nodeSize - 1);
30
+ from = Math.min(from, position + offset);
31
+ to = Math.max(to, position + node.nodeSize - offset);
32
+ }
31
33
  });
32
34
 
33
35
  commands.setTextSelection({ from, to });
36
+ }),
37
+
38
+ expandSelectionToBlock: createCommand(({ commands }) => {
39
+ commands.expandSelection(({ parent }) => parent.type.name === NodeTypes.DOCUMENT);
34
40
  })
35
41
  };
36
42
  }
@@ -442,6 +442,32 @@ describe('get mark', () => {
442
442
  });
443
443
  });
444
444
 
445
+ describe('has mark', () => {
446
+ test('should detect mark', () => {
447
+ const editor = createEditor({
448
+ content: NodeFactory.doc([
449
+ NodeFactory.paragraph([
450
+ NodeFactory.text('lorem ipsum', [
451
+ NodeFactory.mark(TextSettings.FONT_WEIGHT, { value: '700' })
452
+ ])
453
+ ])
454
+ ])
455
+ });
456
+
457
+ expect(editor.commands.hasMark(TextSettings.FONT_WEIGHT).value).toBe(true);
458
+ });
459
+
460
+ test('should not detect mark', () => {
461
+ const editor = createEditor({
462
+ content: NodeFactory.doc([
463
+ NodeFactory.paragraph('lorem ipsum')
464
+ ])
465
+ });
466
+
467
+ expect(editor.commands.hasMark(TextSettings.FONT_WEIGHT).value).toBe(false);
468
+ });
469
+ });
470
+
445
471
  describe('get setting mark', () => {
446
472
  test('should get common setting mark', () => {
447
473
  const editor = createEditor({
@@ -49,8 +49,22 @@ describe('store/restore selection', () => {
49
49
  });
50
50
  });
51
51
 
52
- describe('expand selection to block', () => {
53
- test('should exand selection to one block', () => {
52
+ describe('expand selection', () => {
53
+ test('should expand selection by condition', () => {
54
+ const editor = createEditor();
55
+
56
+ editor
57
+ .chain()
58
+ .setTextSelection({ from: 10, to: 20 })
59
+ .expandSelection(({ node }) => node.isText)
60
+ .run();
61
+
62
+ expect(editor.state.selection).toEqual(
63
+ expect.objectContaining({ from: 1, to: 27 })
64
+ );
65
+ });
66
+
67
+ test('should expand selection to one block', () => {
54
68
  const editor = createEditor();
55
69
 
56
70
  editor
@@ -31,3 +31,5 @@ export const buildCoreExtensions = () => [
31
31
  SelectionProcessor,
32
32
  ProseMirrorPlugins
33
33
  ];
34
+
35
+ export * from './steps';
@@ -136,9 +136,6 @@ export class NodeFactory {
136
136
  * @returns {{tablet, desktop, mobile}}
137
137
  */
138
138
  static populateAllDevices(value) {
139
- // return { mobile: value, tablet: value, desktop: value };
140
-
141
- // Temporary until release BUILDER_MODES
142
- return { mobile: null, tablet: value, desktop: value };
139
+ return { mobile: value, tablet: value, desktop: value };
143
140
  }
144
141
  }
@@ -320,7 +320,7 @@ Object {
320
320
  exports[`build node should populate value to all devices 1`] = `
321
321
  Object {
322
322
  "desktop": "18",
323
- "mobile": null,
323
+ "mobile": "18",
324
324
  "tablet": "18",
325
325
  }
326
326
  `;
@@ -1,8 +1,8 @@
1
1
  import { isMarkAppliedToParent } from '../isMarkAppliedToParent';
2
2
 
3
3
  const createMark = (attrs = {}) => ({
4
- isInSet(set) {
5
- return set.includes(this);
4
+ eq(another) {
5
+ return JSON.stringify(this) === JSON.stringify(another);
6
6
  },
7
7
  ...attrs
8
8
  });
@@ -34,15 +34,15 @@ describe('is mark applied to parent', () => {
34
34
  });
35
35
 
36
36
  test('should return false if not applied to parent', () => {
37
- const checkingMark = createMark();
37
+ const checkingMark = createMark({ attrs: { value: '400' } });
38
38
  const doc = createNode();
39
39
 
40
40
  doc.resolve.mockReturnValue({
41
41
  path: [
42
- createNode({ marks: [createMark()] }),
42
+ createNode({ marks: [createMark({ attrs: { value: '700' } })] }),
43
43
  0,
44
44
  0,
45
- createNode({ marks: [createMark()] }),
45
+ createNode({ marks: [createMark({ attrs: { value: '700' } })] }),
46
46
  0,
47
47
  1
48
48
  ]
@@ -9,6 +9,7 @@ export { convertAlignment } from './convertAlignment';
9
9
  export { importIcon } from './importIcon';
10
10
  export { isWysiwygContent, markWysiwygContent, unmarkWysiwygContent } from './isWysiwygContent';
11
11
  export { resolveTextPosition } from './resolveTextPosition';
12
+ export { resolvePositionOffset } from './resolvePositionOffset';
12
13
  export { isNodeFullySelected } from './isNodeFullySelected';
13
14
  export { isMarkAppliedToParent } from './isMarkAppliedToParent';
14
15
  export { findMarkByType } from './findMarkByType';