@zipify/wysiwyg 1.0.0-dev.76 → 1.0.0-dev.79
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 +11 -10
- package/dist/wysiwyg.mjs +13 -6
- package/lib/Wysiwyg.vue +1 -2
- package/lib/components/base/colorPicker/ColorPicker.vue +1 -0
- package/lib/components/base/composables/useModalToggler.js +1 -0
- package/lib/components/toolbar/Toolbar.vue +1 -0
- package/lib/composables/__tests__/__snapshots__/useEditor.test.js.snap +1 -0
- package/lib/composables/useEditor.js +4 -2
- package/lib/composables/useToolbar.js +1 -0
- package/lib/utils/index.js +1 -1
- package/lib/utils/isWysiwygContent.js +5 -0
- package/package.json +2 -2
package/dist/wysiwyg.css
CHANGED
|
@@ -631,15 +631,16 @@
|
|
|
631
631
|
width: 234px;
|
|
632
632
|
}
|
|
633
633
|
|
|
634
|
-
.zw-toolbar[data-v-
|
|
634
|
+
.zw-toolbar[data-v-7afee166] {
|
|
635
635
|
border-radius: 2px;
|
|
636
636
|
background-color: rgb(var(--zw-color-n15));
|
|
637
637
|
color: rgb(var(--zw-color-n70));
|
|
638
638
|
z-index: 999999;
|
|
639
639
|
text-align: left;
|
|
640
|
+
position: fixed;
|
|
640
641
|
}
|
|
641
|
-
.zw-toolbar[data-v-
|
|
642
|
-
.zw-toolbar[data-v-
|
|
642
|
+
.zw-toolbar[data-v-7afee166]::before,
|
|
643
|
+
.zw-toolbar[data-v-7afee166]::after {
|
|
643
644
|
content: "";
|
|
644
645
|
display: block;
|
|
645
646
|
width: 100%;
|
|
@@ -647,21 +648,21 @@
|
|
|
647
648
|
position: absolute;
|
|
648
649
|
--zw-toolbar-safe-zone: calc(-1 * var(--zw-toolbar-offset-y));
|
|
649
650
|
}
|
|
650
|
-
.zw-toolbar[data-v-
|
|
651
|
+
.zw-toolbar[data-v-7afee166]::before {
|
|
651
652
|
top: var(--zw-toolbar-safe-zone);
|
|
652
653
|
}
|
|
653
|
-
.zw-toolbar[data-v-
|
|
654
|
+
.zw-toolbar[data-v-7afee166]::after {
|
|
654
655
|
bottom: var(--zw-toolbar-safe-zone);
|
|
655
656
|
}
|
|
656
|
-
.zw-toolbar--enter-active[data-v-
|
|
657
|
-
.zw-toolbar--leave-active[data-v-
|
|
657
|
+
.zw-toolbar--enter-active[data-v-7afee166],
|
|
658
|
+
.zw-toolbar--leave-active[data-v-7afee166] {
|
|
658
659
|
transition: opacity 150ms ease-out;
|
|
659
660
|
}
|
|
660
|
-
.zw-toolbar--leave-active[data-v-
|
|
661
|
+
.zw-toolbar--leave-active[data-v-7afee166] {
|
|
661
662
|
transition: opacity 0s ease-in;
|
|
662
663
|
}
|
|
663
|
-
.zw-toolbar--enter[data-v-
|
|
664
|
-
.zw-toolbar--leave-to[data-v-
|
|
664
|
+
.zw-toolbar--enter[data-v-7afee166],
|
|
665
|
+
.zw-toolbar--leave-to[data-v-7afee166] {
|
|
665
666
|
opacity: 0;
|
|
666
667
|
}
|
|
667
668
|
.zw-wysiwyg {
|
package/dist/wysiwyg.mjs
CHANGED
|
@@ -14394,6 +14394,9 @@ function importIcon(name) {
|
|
|
14394
14394
|
function isWysiwygContent(content) {
|
|
14395
14395
|
return typeof content === "object" && content.__wswg__;
|
|
14396
14396
|
}
|
|
14397
|
+
function unmarkWysiwygContent({ __wswg__, ...content }) {
|
|
14398
|
+
return content;
|
|
14399
|
+
}
|
|
14397
14400
|
function markWysiwygContent(content) {
|
|
14398
14401
|
return { ...content, __wswg__: true };
|
|
14399
14402
|
}
|
|
@@ -18969,6 +18972,7 @@ function useModalToggler({ onBeforeOpened, onClosed, wrapperRef, modalRef } = {}
|
|
|
18969
18972
|
const modalEl = useElementRef(modalRef);
|
|
18970
18973
|
popper2 = createPopper(wrapperEl.value, modalEl.value, {
|
|
18971
18974
|
placement: "bottom",
|
|
18975
|
+
strategy: "fixed",
|
|
18972
18976
|
modifiers: [
|
|
18973
18977
|
{
|
|
18974
18978
|
name: "offset",
|
|
@@ -20490,6 +20494,7 @@ var render$q = function __render__20() {
|
|
|
20490
20494
|
ref: "pickerRef",
|
|
20491
20495
|
attrs: {
|
|
20492
20496
|
"placement": "bottom-end",
|
|
20497
|
+
"placement-strategy": "fixed",
|
|
20493
20498
|
"favorite-colors": _vm.favoriteColors,
|
|
20494
20499
|
"window": _vm.window
|
|
20495
20500
|
},
|
|
@@ -22767,7 +22772,7 @@ var __component__$1 = /* @__PURE__ */ normalizeComponent(
|
|
|
22767
22772
|
staticRenderFns$1,
|
|
22768
22773
|
false,
|
|
22769
22774
|
__vue2_injectStyles$1,
|
|
22770
|
-
"
|
|
22775
|
+
"7afee166",
|
|
22771
22776
|
null,
|
|
22772
22777
|
null
|
|
22773
22778
|
);
|
|
@@ -22782,16 +22787,17 @@ const Toolbar = /* @__PURE__ */ function() {
|
|
|
22782
22787
|
function useEditor({ content, onChange, extensions: extensions2, isReadonlyRef }) {
|
|
22783
22788
|
const editor = reactive(new Editor({
|
|
22784
22789
|
content: ContentNormalizer.normalize(content.value),
|
|
22785
|
-
onUpdate: () => onChange(editor.getJSON()),
|
|
22790
|
+
onUpdate: () => onChange(markWysiwygContent(editor.getJSON())),
|
|
22786
22791
|
extensions: extensions2,
|
|
22787
22792
|
injectCSS: false
|
|
22788
22793
|
}));
|
|
22789
22794
|
onUnmounted(() => editor.destroy());
|
|
22790
22795
|
watch(content, (value) => {
|
|
22791
|
-
const
|
|
22796
|
+
const content2 = unmarkWysiwygContent(value);
|
|
22797
|
+
const isChanged = JSON.stringify(editor.getJSON()) !== JSON.stringify(content2);
|
|
22792
22798
|
if (isChanged) {
|
|
22793
|
-
const
|
|
22794
|
-
editor.commands.setContent(
|
|
22799
|
+
const content3 = ContentNormalizer.normalize(value);
|
|
22800
|
+
editor.commands.setContent(content3, false);
|
|
22795
22801
|
}
|
|
22796
22802
|
});
|
|
22797
22803
|
watch(isReadonlyRef, (isReadonly) => editor.setEditable(!isReadonly), { immediate: true });
|
|
@@ -22803,6 +22809,7 @@ function useToolbar({ wrapperRef, offsets, isActiveRef }) {
|
|
|
22803
22809
|
function mount(element) {
|
|
22804
22810
|
popper2 = createPopper(wrapperEl.value, element, {
|
|
22805
22811
|
placement: "top-start",
|
|
22812
|
+
strategy: "fixed",
|
|
22806
22813
|
modifiers: [
|
|
22807
22814
|
{
|
|
22808
22815
|
name: "offset",
|
|
@@ -25958,7 +25965,7 @@ const __vue2_script = {
|
|
|
25958
25965
|
});
|
|
25959
25966
|
const updateToolbar = () => toolbar.update();
|
|
25960
25967
|
function onChange(content) {
|
|
25961
|
-
emit("input",
|
|
25968
|
+
emit("input", content);
|
|
25962
25969
|
updateToolbar();
|
|
25963
25970
|
}
|
|
25964
25971
|
const pageBlocks = toRef(props, "pageBlocks");
|
package/lib/Wysiwyg.vue
CHANGED
|
@@ -21,7 +21,6 @@ import { ContextWindow, FavoriteColors, Storage } from './services';
|
|
|
21
21
|
import { Devices } from './enums';
|
|
22
22
|
import { outClick } from './directives';
|
|
23
23
|
import { Font } from './models';
|
|
24
|
-
import { markWysiwygContent } from './utils';
|
|
25
24
|
|
|
26
25
|
const MIN_FONT_SIZE = 5;
|
|
27
26
|
const MAX_FONT_SIZE = 112;
|
|
@@ -151,7 +150,7 @@ export default {
|
|
|
151
150
|
const updateToolbar = () => toolbar.update();
|
|
152
151
|
|
|
153
152
|
function onChange(content) {
|
|
154
|
-
emit('input',
|
|
153
|
+
emit('input', content);
|
|
155
154
|
updateToolbar();
|
|
156
155
|
}
|
|
157
156
|
|
|
@@ -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()),
|
|
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
|
|
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);
|
package/lib/utils/index.js
CHANGED
|
@@ -7,4 +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 } from './isWysiwygContent';
|
|
10
|
+
export { isWysiwygContent, markWysiwygContent, unmarkWysiwygContent } from './isWysiwygContent';
|
|
@@ -2,6 +2,11 @@ export function isWysiwygContent(content) {
|
|
|
2
2
|
return typeof content === 'object' && content.__wswg__;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
+
// eslint-disable-next-line no-unused-vars
|
|
6
|
+
export function unmarkWysiwygContent({ __wswg__, ...content }) {
|
|
7
|
+
return content;
|
|
8
|
+
}
|
|
9
|
+
|
|
5
10
|
export function markWysiwygContent(content) {
|
|
6
11
|
return { ...content, __wswg__: true };
|
|
7
12
|
}
|
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.79",
|
|
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.
|
|
46
|
+
"@zipify/colorpicker": "^2.2",
|
|
47
47
|
"vue": "^2.7"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|