@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 +19 -5
- package/lib/components/base/colorPicker/ColorPicker.vue +1 -0
- package/lib/components/base/composables/useModalToggler.js +1 -0
- package/lib/composables/useEditor.js +4 -2
- package/lib/composables/useToolbar.js +1 -0
- package/lib/index.js +1 -0
- package/lib/utils/index.js +1 -0
- package/lib/utils/isWysiwygContent.js +12 -0
- package/package.json +2 -2
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(
|
|
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
|
|
22796
|
+
const content2 = unmarkWysiwygContent(value);
|
|
22797
|
+
const isChanged = JSON.stringify(editor.getJSON()) !== JSON.stringify(content2);
|
|
22786
22798
|
if (isChanged) {
|
|
22787
|
-
const
|
|
22788
|
-
editor.commands.setContent(
|
|
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
|
};
|
|
@@ -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(
|
|
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/index.js
CHANGED
package/lib/utils/index.js
CHANGED
|
@@ -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.
|
|
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.
|
|
46
|
+
"@zipify/colorpicker": "^2.2",
|
|
47
47
|
"vue": "^2.7"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|