@zipify/wysiwyg 1.0.0-dev.75 → 1.0.0-dev.78

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 CHANGED
@@ -14391,6 +14391,15 @@ function importIcon(name) {
14391
14391
  }
14392
14392
  return icon;
14393
14393
  }
14394
+ function isWysiwygContent(content) {
14395
+ return typeof content === "object" && content.__wswg__;
14396
+ }
14397
+ function unmarkWysiwygContent({ __wswg__, ...content }) {
14398
+ return content;
14399
+ }
14400
+ function markWysiwygContent(content) {
14401
+ return { ...content, __wswg__: true };
14402
+ }
14394
14403
  var render$E = function __render__6() {
14395
14404
  var _vm = this;
14396
14405
  var _h = _vm.$createElement;
@@ -18963,6 +18972,7 @@ function useModalToggler({ onBeforeOpened, onClosed, wrapperRef, modalRef } = {}
18963
18972
  const modalEl = useElementRef(modalRef);
18964
18973
  popper2 = createPopper(wrapperEl.value, modalEl.value, {
18965
18974
  placement: "bottom",
18975
+ strategy: "fixed",
18966
18976
  modifiers: [
18967
18977
  {
18968
18978
  name: "offset",
@@ -20484,6 +20494,7 @@ var render$q = function __render__20() {
20484
20494
  ref: "pickerRef",
20485
20495
  attrs: {
20486
20496
  "placement": "bottom-end",
20497
+ "placement-strategy": "fixed",
20487
20498
  "favorite-colors": _vm.favoriteColors,
20488
20499
  "window": _vm.window
20489
20500
  },
@@ -22776,16 +22787,17 @@ const Toolbar = /* @__PURE__ */ function() {
22776
22787
  function useEditor({ content, onChange, extensions: extensions2, isReadonlyRef }) {
22777
22788
  const editor = reactive(new Editor({
22778
22789
  content: ContentNormalizer.normalize(content.value),
22779
- onUpdate: () => onChange({ ...editor.getJSON(), __wswg__: true }),
22790
+ onUpdate: () => onChange(markWysiwygContent(editor.getJSON())),
22780
22791
  extensions: extensions2,
22781
22792
  injectCSS: false
22782
22793
  }));
22783
22794
  onUnmounted(() => editor.destroy());
22784
22795
  watch(content, (value) => {
22785
- const isChanged = JSON.stringify(editor.getJSON()) !== JSON.stringify(value);
22796
+ const content2 = unmarkWysiwygContent(value);
22797
+ const isChanged = JSON.stringify(editor.getJSON()) !== JSON.stringify(content2);
22786
22798
  if (isChanged) {
22787
- const content2 = ContentNormalizer.normalize(value);
22788
- editor.commands.setContent(content2, false);
22799
+ const content3 = ContentNormalizer.normalize(value);
22800
+ editor.commands.setContent(content3, false);
22789
22801
  }
22790
22802
  });
22791
22803
  watch(isReadonlyRef, (isReadonly) => editor.setEditable(!isReadonly), { immediate: true });
@@ -22797,6 +22809,7 @@ function useToolbar({ wrapperRef, offsets, isActiveRef }) {
22797
22809
  function mount(element) {
22798
22810
  popper2 = createPopper(wrapperEl.value, element, {
22799
22811
  placement: "top-start",
22812
+ strategy: "fixed",
22800
22813
  modifiers: [
22801
22814
  {
22802
22815
  name: "offset",
@@ -26020,5 +26033,6 @@ export {
26020
26033
  NodeFactory,
26021
26034
  NodeTypes,
26022
26035
  TextSettings,
26023
- Wysiwyg
26036
+ Wysiwyg,
26037
+ isWysiwygContent
26024
26038
  };
@@ -2,6 +2,7 @@
2
2
  <ZipifyColorPicker
3
3
  ref="pickerRef"
4
4
  placement="bottom-end"
5
+ placement-strategy="fixed"
5
6
  :favorite-colors="favoriteColors"
6
7
  :window="window"
7
8
  @changeFavoriteColors="updateFavoriteColors"
@@ -14,6 +14,7 @@ export function useModalToggler({ onBeforeOpened, onClosed, wrapperRef, modalRef
14
14
 
15
15
  popper = createPopper(wrapperEl.value, modalEl.value, {
16
16
  placement: 'bottom',
17
+ strategy: 'fixed',
17
18
  modifiers: [
18
19
  {
19
20
  name: 'offset',
@@ -1,11 +1,12 @@
1
1
  import { Editor } from '@tiptap/vue-2';
2
2
  import { onUnmounted, watch, reactive } from 'vue';
3
3
  import { ContentNormalizer } from '../services';
4
+ import { markWysiwygContent, unmarkWysiwygContent } from '../utils';
4
5
 
5
6
  export function useEditor({ content, onChange, extensions, isReadonlyRef }) {
6
7
  const editor = reactive(new Editor({
7
8
  content: ContentNormalizer.normalize(content.value),
8
- onUpdate: () => onChange({ ...editor.getJSON(), __wswg__: true }),
9
+ onUpdate: () => onChange(markWysiwygContent(editor.getJSON())),
9
10
  extensions,
10
11
  injectCSS: false
11
12
  }));
@@ -13,7 +14,8 @@ export function useEditor({ content, onChange, extensions, isReadonlyRef }) {
13
14
  onUnmounted(() => editor.destroy());
14
15
 
15
16
  watch(content, (value) => {
16
- const isChanged = JSON.stringify(editor.getJSON()) !== JSON.stringify(value);
17
+ const content = unmarkWysiwygContent(value);
18
+ const isChanged = JSON.stringify(editor.getJSON()) !== JSON.stringify(content);
17
19
 
18
20
  if (isChanged) {
19
21
  const content = ContentNormalizer.normalize(value);
@@ -8,6 +8,7 @@ export function useToolbar({ wrapperRef, offsets, isActiveRef }) {
8
8
  function mount(element) {
9
9
  popper = createPopper(wrapperEl.value, element, {
10
10
  placement: 'top-start',
11
+ strategy: 'fixed',
11
12
  modifiers: [
12
13
  {
13
14
  name: 'offset',
package/lib/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export { default as Wysiwyg } from './Wysiwyg';
2
2
  export { NodeFactory } from './services';
3
3
  export { NodeTypes, TextSettings, Alignments } from './enums';
4
+ export { isWysiwygContent } from './utils';
@@ -7,3 +7,4 @@ export { convertLineHeight } from './convertLineHeight';
7
7
  export { convertFontSize } from './convertFontSize';
8
8
  export { convertAlignment } from './convertAlignment';
9
9
  export { importIcon } from './importIcon';
10
+ export { isWysiwygContent, markWysiwygContent, unmarkWysiwygContent } from './isWysiwygContent';
@@ -0,0 +1,12 @@
1
+ export function isWysiwygContent(content) {
2
+ return typeof content === 'object' && content.__wswg__;
3
+ }
4
+
5
+ // eslint-disable-next-line no-unused-vars
6
+ export function unmarkWysiwygContent({ __wswg__, ...content }) {
7
+ return content;
8
+ }
9
+
10
+ export function markWysiwygContent(content) {
11
+ return { ...content, __wswg__: true };
12
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zipify/wysiwyg",
3
- "version": "1.0.0-dev.75",
3
+ "version": "1.0.0-dev.78",
4
4
  "description": "Zipify modification of TipTap text editor",
5
5
  "main": "dist/wysiwyg.mjs",
6
6
  "repository": {
@@ -43,7 +43,7 @@
43
43
  "simplebar": "^5.3.8"
44
44
  },
45
45
  "peerDependencies": {
46
- "@zipify/colorpicker": "^2.1",
46
+ "@zipify/colorpicker": "^2.2",
47
47
  "vue": "^2.7"
48
48
  },
49
49
  "devDependencies": {