goodteditor-ui 1.0.59 → 1.0.61

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "goodteditor-ui",
3
- "version": "1.0.59",
3
+ "version": "1.0.61",
4
4
  "main": "index.js",
5
5
  "homepage": "https://goodt-ui.netlify.app/",
6
6
  "scripts": {
@@ -2,7 +2,7 @@ Simple example
2
2
  ```vue
3
3
  <template>
4
4
  <div class="pad-l5">
5
- <ui-wysiwyg-editor v-model="model" :autofocus="false"></ui-wysiwyg-editor>
5
+ <ui-wysiwyg-editor v-model="model" :autofocus="false" :editorContent="{ class: ['h-100', 'pad-3', 'scroll-y'] }"></ui-wysiwyg-editor>
6
6
  </div>
7
7
  </template>
8
8
  <script>
@@ -18,7 +18,7 @@ export default {
18
18
  </script>
19
19
  ```
20
20
 
21
- Advanced example. Using custom tool groups, bubble menu and 'change' event instead of 'input'
21
+ Advanced example. Using custom tool groups, bubble menu and 'change' event instead of 'input' to update the model
22
22
 
23
23
  ```vue
24
24
  <template>
@@ -29,7 +29,8 @@ Advanced example. Using custom tool groups, bubble menu and 'change' event inste
29
29
  tools,
30
30
  focusVisible: false,
31
31
  autofocus: false,
32
- bubbleMenu: true
32
+ bubbleMenu: true,
33
+ editorContent: { class: ['h-100', 'pad-3', 'scroll-y'] }
33
34
  }"
34
35
  @change="onChange"></ui-wysiwyg-editor>
35
36
  </div>
@@ -109,7 +109,17 @@ export default {
109
109
  autofocus: {
110
110
  type: [Boolean, String, Number],
111
111
  default: WysiwygAutofocus.END
112
- }
112
+ },
113
+ /**
114
+ * Editor content options for styling css/style
115
+ * { class: string[]|Record<string, boolean> style: string }
116
+ */
117
+ editorContent: {
118
+ type: Object,
119
+ default() {
120
+ return { class: {}, style: '' };
121
+ },
122
+ },
113
123
  },
114
124
  data: () => ({
115
125
  /** @type {Editor} */
@@ -130,9 +140,12 @@ export default {
130
140
  return buildToolGroups(this.tools);
131
141
  },
132
142
  editorClass() {
133
- const classes = ['h-100', 'pad-3', 'scroll-y'];
143
+ const { editorContent: { class: editorClass }, focusVisible } = this;
144
+ const classes = Array.isArray(editorClass)
145
+ ? editorClass
146
+ : Object.entries(editorClass).filter(([, value]) => Boolean(value)).map(([key]) => key);
134
147
 
135
- if (this.focusVisible === false) {
148
+ if (focusVisible === false) {
136
149
  classes.push('focus-outline-none');
137
150
  }
138
151
 
@@ -157,7 +170,7 @@ export default {
157
170
  this.onSelectionUpdateDebounced = debounce(this.onSelectionUpdate, 300);
158
171
  },
159
172
  mounted() {
160
- const { $refs, value, bubbleMenu, autofocus, editorClass, onSelectionUpdateDebounced } = this;
173
+ const { $refs, value, bubbleMenu, autofocus, editorContent, editorClass, onSelectionUpdateDebounced } = this;
161
174
 
162
175
  this.editor = new Editor({
163
176
  content: value,
@@ -172,7 +185,8 @@ export default {
172
185
  autofocus,
173
186
  editorProps: {
174
187
  attributes: {
175
- class: editorClass
188
+ class: editorClass,
189
+ style: editorContent?.style ?? ''
176
190
  }
177
191
  },
178
192
  onUpdate: () => {
@@ -11,8 +11,20 @@ import BubbleMenuToExtend from '@tiptap/extension-bubble-menu';
11
11
  */
12
12
  export const BubbleMenu = ({
13
13
  element = null,
14
- tippyOptions = { maxWidth: 'none', zIndex: 1010 },
15
- } = {}) => BubbleMenuToExtend.configure({
16
- element,
17
- tippyOptions,
18
- });
14
+ tippyOptions = { maxWidth: 'none', appendTo: () => document.body },
15
+ } = {}) => {
16
+ const {
17
+ maxWidth = 'none',
18
+ appendTo = () => document.body,
19
+ ...restOptions
20
+ } = tippyOptions;
21
+
22
+ return BubbleMenuToExtend.configure({
23
+ element,
24
+ tippyOptions: {
25
+ maxWidth,
26
+ appendTo,
27
+ ...restOptions
28
+ },
29
+ });
30
+ };