@zipify/wysiwyg 1.0.0-dev.48 → 1.0.0-dev.49
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/config/vite/lib.config.js +2 -0
- package/dist/wysiwyg.mjs +23 -13
- package/dist/wysiwyg.mjs.map +1 -0
- package/lib/Wysiwyg.vue +14 -2
- package/lib/composables/useToolbar.js +3 -4
- package/package.json +1 -1
package/lib/Wysiwyg.vue
CHANGED
|
@@ -110,6 +110,11 @@ export default {
|
|
|
110
110
|
}
|
|
111
111
|
},
|
|
112
112
|
|
|
113
|
+
emits: [
|
|
114
|
+
'input',
|
|
115
|
+
'updateFavoriteColors'
|
|
116
|
+
],
|
|
117
|
+
|
|
113
118
|
setup(props, { emit }) {
|
|
114
119
|
ContextWindow.use(props.window);
|
|
115
120
|
|
|
@@ -123,10 +128,11 @@ export default {
|
|
|
123
128
|
isActiveRef: toRef(props, 'active'),
|
|
124
129
|
offsets: props.toolbarOffsets
|
|
125
130
|
});
|
|
131
|
+
const updateToolbar = () => toolbar.update();
|
|
126
132
|
|
|
127
133
|
function onChange(content) {
|
|
128
134
|
emit('input', content);
|
|
129
|
-
|
|
135
|
+
updateToolbar();
|
|
130
136
|
}
|
|
131
137
|
|
|
132
138
|
const pageBlocks = toRef(props, 'pageBlocks');
|
|
@@ -166,7 +172,13 @@ export default {
|
|
|
166
172
|
provide(InjectionTokens.FAVORITE_COLORS, favoriteColors);
|
|
167
173
|
provide(InjectionTokens.PAGE_BLOCKS, pageBlocks);
|
|
168
174
|
|
|
169
|
-
return {
|
|
175
|
+
return {
|
|
176
|
+
editor,
|
|
177
|
+
toolbarRef,
|
|
178
|
+
wysiwygRef,
|
|
179
|
+
toolbar,
|
|
180
|
+
updateToolbar
|
|
181
|
+
};
|
|
170
182
|
}
|
|
171
183
|
};
|
|
172
184
|
</script>
|
|
@@ -3,10 +3,10 @@ import { useElementRef } from '../components/base';
|
|
|
3
3
|
|
|
4
4
|
export function useToolbar({ wrapperRef, offsets, isActiveRef }) {
|
|
5
5
|
const wrapperEl = useElementRef(wrapperRef);
|
|
6
|
-
let
|
|
6
|
+
let popper;
|
|
7
7
|
|
|
8
8
|
function mount(element) {
|
|
9
|
-
|
|
9
|
+
popper = createPopper(wrapperEl.value, element, {
|
|
10
10
|
placement: 'top-start',
|
|
11
11
|
modifiers: [
|
|
12
12
|
{
|
|
@@ -28,10 +28,9 @@ export function useToolbar({ wrapperRef, offsets, isActiveRef }) {
|
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
const update = () =>
|
|
31
|
+
const update = () => popper?.update();
|
|
32
32
|
|
|
33
33
|
return {
|
|
34
|
-
toolbar,
|
|
35
34
|
update,
|
|
36
35
|
mount,
|
|
37
36
|
isActiveRef,
|