@zipify/wysiwyg 1.0.0-dev.86 → 1.0.0-dev.87
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 +25 -21
- package/lib/Wysiwyg.vue +7 -0
- package/lib/composables/useToolbar.js +19 -25
- package/package.json +1 -1
package/dist/wysiwyg.mjs
CHANGED
|
@@ -22824,31 +22824,29 @@ function useEditor({ content, onChange, extensions: extensions2, isReadonlyRef }
|
|
|
22824
22824
|
watch(isReadonlyRef, (isReadonly) => editor.setEditable(!isReadonly), { immediate: true });
|
|
22825
22825
|
return editor;
|
|
22826
22826
|
}
|
|
22827
|
-
function useToolbar({ wrapperRef, offsets, isActiveRef }) {
|
|
22827
|
+
function useToolbar({ wrapperRef, offsets, isActiveRef, placementRef }) {
|
|
22828
22828
|
const wrapperEl = useElementRef(wrapperRef);
|
|
22829
22829
|
let popper2;
|
|
22830
22830
|
function mount(element) {
|
|
22831
|
-
const modifiers2 = [
|
|
22832
|
-
{
|
|
22833
|
-
name: "offset",
|
|
22834
|
-
options: { offset: offsets }
|
|
22835
|
-
},
|
|
22836
|
-
{
|
|
22837
|
-
name: "preventOverflow",
|
|
22838
|
-
options: {
|
|
22839
|
-
altAxis: true,
|
|
22840
|
-
padding: 2
|
|
22841
|
-
}
|
|
22842
|
-
},
|
|
22843
|
-
{
|
|
22844
|
-
name: "flip",
|
|
22845
|
-
options: { boundary: "document" }
|
|
22846
|
-
}
|
|
22847
|
-
];
|
|
22848
|
-
console.log(modifiers2, ContextWindow);
|
|
22849
22831
|
popper2 = createPopper(wrapperEl.value, element, {
|
|
22850
|
-
placement:
|
|
22851
|
-
modifiers:
|
|
22832
|
+
placement: placementRef.value,
|
|
22833
|
+
modifiers: [
|
|
22834
|
+
{
|
|
22835
|
+
name: "offset",
|
|
22836
|
+
options: { offset: offsets }
|
|
22837
|
+
},
|
|
22838
|
+
{
|
|
22839
|
+
name: "preventOverflow",
|
|
22840
|
+
options: {
|
|
22841
|
+
altAxis: true,
|
|
22842
|
+
padding: 2
|
|
22843
|
+
}
|
|
22844
|
+
},
|
|
22845
|
+
{
|
|
22846
|
+
name: "flip",
|
|
22847
|
+
enabled: false
|
|
22848
|
+
}
|
|
22849
|
+
]
|
|
22852
22850
|
});
|
|
22853
22851
|
}
|
|
22854
22852
|
const update = () => popper2 == null ? void 0 : popper2.update();
|
|
@@ -25885,6 +25883,11 @@ const __vue2_script = {
|
|
|
25885
25883
|
required: false,
|
|
25886
25884
|
default: () => [0, 8]
|
|
25887
25885
|
},
|
|
25886
|
+
toolbarPlacement: {
|
|
25887
|
+
type: String,
|
|
25888
|
+
required: true,
|
|
25889
|
+
default: "top-start"
|
|
25890
|
+
},
|
|
25888
25891
|
baseListClass: {
|
|
25889
25892
|
type: String,
|
|
25890
25893
|
required: false,
|
|
@@ -25925,6 +25928,7 @@ const __vue2_script = {
|
|
|
25925
25928
|
const isToolbarActiveRef = computed(() => props.active && !props.readonly);
|
|
25926
25929
|
const toolbar = useToolbar({
|
|
25927
25930
|
wrapperRef: wysiwygRef,
|
|
25931
|
+
placementRef: toRef(props, "toolbarPlacement"),
|
|
25928
25932
|
isActiveRef: isToolbarActiveRef,
|
|
25929
25933
|
offsets: props.toolbarOffsets
|
|
25930
25934
|
});
|
package/lib/Wysiwyg.vue
CHANGED
|
@@ -96,6 +96,12 @@ export default {
|
|
|
96
96
|
default: () => [0, 8]
|
|
97
97
|
},
|
|
98
98
|
|
|
99
|
+
toolbarPlacement: {
|
|
100
|
+
type: String,
|
|
101
|
+
required: true,
|
|
102
|
+
default: 'top-start'
|
|
103
|
+
},
|
|
104
|
+
|
|
99
105
|
baseListClass: {
|
|
100
106
|
type: String,
|
|
101
107
|
required: false,
|
|
@@ -144,6 +150,7 @@ export default {
|
|
|
144
150
|
|
|
145
151
|
const toolbar = useToolbar({
|
|
146
152
|
wrapperRef: wysiwygRef,
|
|
153
|
+
placementRef: toRef(props, 'toolbarPlacement'),
|
|
147
154
|
isActiveRef: isToolbarActiveRef,
|
|
148
155
|
offsets: props.toolbarOffsets
|
|
149
156
|
});
|
|
@@ -1,36 +1,30 @@
|
|
|
1
1
|
import { createPopper } from '@popperjs/core';
|
|
2
2
|
import { useElementRef } from '../components/base';
|
|
3
|
-
import { ContextWindow } from '../services';
|
|
4
3
|
|
|
5
|
-
export function useToolbar({ wrapperRef, offsets, isActiveRef }) {
|
|
4
|
+
export function useToolbar({ wrapperRef, offsets, isActiveRef, placementRef }) {
|
|
6
5
|
const wrapperEl = useElementRef(wrapperRef);
|
|
7
6
|
let popper;
|
|
8
7
|
|
|
9
8
|
function mount(element) {
|
|
10
|
-
const modifiers = [
|
|
11
|
-
{
|
|
12
|
-
name: 'offset',
|
|
13
|
-
options: { offset: offsets }
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
name: 'preventOverflow',
|
|
17
|
-
options: {
|
|
18
|
-
altAxis: true,
|
|
19
|
-
padding: 2
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
name: 'flip',
|
|
24
|
-
options: { boundary: 'document' }
|
|
25
|
-
}
|
|
26
|
-
];
|
|
27
|
-
|
|
28
|
-
// eslint-disable-next-line no-console
|
|
29
|
-
console.log(modifiers, ContextWindow);
|
|
30
|
-
|
|
31
9
|
popper = createPopper(wrapperEl.value, element, {
|
|
32
|
-
placement:
|
|
33
|
-
modifiers
|
|
10
|
+
placement: placementRef.value,
|
|
11
|
+
modifiers: [
|
|
12
|
+
{
|
|
13
|
+
name: 'offset',
|
|
14
|
+
options: { offset: offsets }
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: 'preventOverflow',
|
|
18
|
+
options: {
|
|
19
|
+
altAxis: true,
|
|
20
|
+
padding: 2
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'flip',
|
|
25
|
+
enabled: false
|
|
26
|
+
}
|
|
27
|
+
]
|
|
34
28
|
});
|
|
35
29
|
}
|
|
36
30
|
|