goodteditor-ui 1.0.52 → 1.0.54

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,11 +1,11 @@
1
1
  {
2
2
  "name": "goodteditor-ui",
3
- "version": "1.0.52",
3
+ "version": "1.0.54",
4
4
  "main": "index.js",
5
5
  "homepage": "https://goodt-ui.netlify.app/",
6
6
  "scripts": {
7
- "serve": "npx vue-styleguidist server",
8
- "build": "npx vue-styleguidist build",
7
+ "serve": "vue-cli-service styleguidist",
8
+ "build": "vue-cli-service styleguidist:build",
9
9
  "dev": "vue-cli-service serve",
10
10
  "docs:build": "set NODE_ENV=development && npm run build",
11
11
  "docs:deploy": "npx netlify deploy --dir=docs --prod"
@@ -29,18 +29,20 @@
29
29
  },
30
30
  "devDependencies": {
31
31
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
32
- "@vue/cli-plugin-babel": "^4.5.11",
33
- "@vue/cli-plugin-eslint": "^4.5.11",
34
- "@vue/cli-service": "^4.5.11",
35
- "axios": "^0.24.0",
32
+ "@vue/cli-plugin-babel": "^5.0.8",
33
+ "@vue/cli-plugin-eslint": "^5.0.8",
34
+ "@vue/cli-service": "^5.0.8",
35
+ "axios": "^1.0.0",
36
36
  "babel-eslint": "^10.1.0",
37
- "eslint": "^6.7.2",
38
- "eslint-plugin-vue": "^6.2.2",
37
+ "eslint": "^7.5.0",
38
+ "eslint-plugin-vue": "^9.25.0",
39
39
  "less": "^3.13.1",
40
- "less-loader": "^5.0.0",
40
+ "less-loader": "^7.0.0",
41
41
  "netlify-cli": "^5.0.1",
42
- "vue-styleguidist": "4.35.0",
43
- "vue-template-compiler": "^2.6.12"
42
+ "vue-cli-plugin-styleguidist": "~4.72.4",
43
+ "vue-styleguidist": "^4.72.4",
44
+ "vue-template-compiler": "^2.6.12",
45
+ "webpack": "^5.91.0"
44
46
  },
45
47
  "peerDependencies": {
46
48
  "vue": "^2.6.12",
@@ -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"></ui-wysiwyg-editor>
5
+ <ui-wysiwyg-editor v-model="model" :autofocus="false"></ui-wysiwyg-editor>
6
6
  </div>
7
7
  </template>
8
8
  <script>
@@ -28,6 +28,7 @@ Advanced example. Using custom tool groups, bubble menu and 'change' event inste
28
28
  value: model,
29
29
  tools,
30
30
  focusVisible: false,
31
+ autoFocus: false,
31
32
  bubbleMenu: { isEnabled: true}
32
33
  }"
33
34
  @change="onChange"></ui-wysiwyg-editor>
@@ -15,7 +15,7 @@
15
15
  <div
16
16
  v-for="({ title, group }, groupIndex) of toolGroups"
17
17
  :key="groupIndex"
18
- class="col col-vmid col-auto">
18
+ class="col col-vbot col-auto">
19
19
  <div class="d-flex flex-col flex-v-center">
20
20
  <div v-if="resolveGroupTitle(title, groupIndex) !== ''" class="group-header">
21
21
  <!--
@@ -64,7 +64,7 @@ import { debounce } from '../utils/Helpers';
64
64
  import Grid from '../Grid.vue';
65
65
  import { resolveExtensions } from './extensions';
66
66
  import { buildToolGroups, bindContext } from './utils';
67
- import { DefaultTools } from './constants';
67
+ import { DefaultTools, WysiwygAutofocus } from './constants';
68
68
 
69
69
  /**
70
70
  * @typedef {Omit<import('@tiptap/extension-bubble-menu').BubbleMenuOptions, 'element'>} BubbleMenuOptions
@@ -119,6 +119,13 @@ export default {
119
119
  focusVisible: {
120
120
  type: Boolean,
121
121
  default: true
122
+ },
123
+ /**
124
+ * whether to force the cursor to jump in the editor on initialization
125
+ */
126
+ autofocus: {
127
+ type: [Boolean, String, Number],
128
+ default: WysiwygAutofocus.END
122
129
  }
123
130
  },
124
131
  data: () => ({
@@ -174,20 +181,21 @@ export default {
174
181
  this.onSelectionUpdateDebounced = debounce(this.onSelectionUpdate, 300);
175
182
  },
176
183
  mounted() {
177
- const { isEnabled: isBubbleMenuEnabled, ...bubbleMenuOptions } = this.bubbleMenu;
184
+ const { $refs, value, bubbleMenu, autofocus, editorClass, onSelectionUpdateDebounced } = this;
185
+ const { isEnabled: isBubbleMenuEnabled, ...bubbleMenuOptions } = bubbleMenu;
178
186
 
179
187
  this.editor = new Editor({
180
- content: this.value,
188
+ content: value,
181
189
  extensions: resolveExtensions({
182
190
  bubbleMenu: {
183
- element: isBubbleMenuEnabled ? this.$refs.menu : null,
191
+ element: isBubbleMenuEnabled ? $refs.menu : null,
184
192
  ...bubbleMenuOptions
185
193
  }
186
194
  }),
187
- autofocus: 'end',
195
+ autofocus,
188
196
  editorProps: {
189
197
  attributes: {
190
- class: this.editorClass,
198
+ class: editorClass,
191
199
  style: 'min-height: 100%; height: 0;'
192
200
  }
193
201
  },
@@ -197,7 +205,7 @@ export default {
197
205
  onBlur: () => {
198
206
  this.onChange();
199
207
  },
200
- onSelectionUpdate: this.onSelectionUpdateDebounced
208
+ onSelectionUpdate: onSelectionUpdateDebounced
201
209
  });
202
210
  },
203
211
  activated() {
@@ -9,7 +9,7 @@ import {
9
9
  Image
10
10
  } from './renders';
11
11
 
12
- export type Render = Readonly<{
12
+ export type WysiwygRender = Readonly<{
13
13
  BUTTON: Button;
14
14
  COLOR_PICKER: ColorPicker;
15
15
  INPUT_UNITS: InputUnits;
@@ -127,6 +127,14 @@ export type ToolType = Readonly<{
127
127
  INSERT_IMAGE: 'insertImage'
128
128
  }>;
129
129
 
130
+ export type WysiwygAutofocus = Readonly<{
131
+ START: 'start',
132
+ END: 'end',
133
+ ALL: 'all',
134
+ ENABLED: true,
135
+ DISABLED: false
136
+ }>;
137
+
130
138
  export type DefaultTools = Array<{
131
139
  title: string,
132
140
  group: Array<string|ITool>
@@ -14,7 +14,8 @@ import {
14
14
  * @typedef {import('./constants').MarkType} MarkType
15
15
  * @typedef {import('./constants').CommandType} CommandType
16
16
  * @typedef {import('./constants').ToolType} ToolType
17
- * @typedef {import('./constants').Render} Render
17
+ * @typedef {import('./constants').WysiwygRender} WysiwygRender
18
+ * @typedef {import('./constants').WysiwygAutofocus} WysiwygAutofocus
18
19
  * @typedef {import('./constants').ICommand} ICommand
19
20
  * @typedef {import('./constants').ITool} ITool
20
21
  */
@@ -147,9 +148,9 @@ export const createCommand = ({
147
148
  });
148
149
 
149
150
  /**
150
- * @type Render
151
+ * @type WysiwygRender
151
152
  */
152
- export const Render = Object.freeze({
153
+ export const WysiwygRender = Object.freeze({
153
154
  BUTTON: Button,
154
155
  COLOR_PICKER: ColorPicker,
155
156
  INPUT_UNITS: InputUnits,
@@ -166,7 +167,7 @@ export const Render = Object.freeze({
166
167
  */
167
168
  export const createTool = ({
168
169
  name = '',
169
- render = Render.BUTTON,
170
+ render = WysiwygRender.BUTTON,
170
171
  title = 'Unknown tool',
171
172
  icon = 'help-circle-outline',
172
173
  exec = () => {},
@@ -184,6 +185,15 @@ export const createTool = ({
184
185
  ...optionalRest
185
186
  });
186
187
 
188
+ /** @type WysiwygAutofocus */
189
+ export const WysiwygAutofocus = Object.freeze({
190
+ START: 'start',
191
+ END: 'end',
192
+ ALL: 'all',
193
+ ENABLED: true,
194
+ DISABLED: false
195
+ });
196
+
187
197
  export const DefaultTools = [
188
198
  {
189
199
  title: 'Оформление',
@@ -44,3 +44,5 @@ export const useRender = () => ({
44
44
  }
45
45
  }
46
46
  });
47
+
48
+ export const RenderMixinTypes = undefined;
@@ -3,7 +3,7 @@ import {
3
3
  MarkType,
4
4
  CommandType,
5
5
  ToolType,
6
- Render,
6
+ WysiwygRender,
7
7
  createTool,
8
8
  createCommand,
9
9
  } from './constants';
@@ -409,7 +409,7 @@ export const ToolsMap = {
409
409
  }),
410
410
  [ToolType.PARAGRAPH_STYLE]: createTool({
411
411
  name: ToolType.PARAGRAPH_STYLE,
412
- render: Render.SELECT,
412
+ render: WysiwygRender.SELECT,
413
413
  title: 'Стиль параграфа',
414
414
  exec(command) {
415
415
  if (command.name in CommandMap && command.isEnabled()) {
@@ -432,7 +432,7 @@ export const ToolsMap = {
432
432
  }),
433
433
  [ToolType.FONT_SIZE]: createTool({
434
434
  name: ToolType.FONT_SIZE,
435
- render: Render.INPUT_UNITS,
435
+ render: WysiwygRender.INPUT_UNITS,
436
436
  title: 'Размер шрифта',
437
437
  exec(value) {
438
438
  this.editor.commands.setFontSize(value);
@@ -453,7 +453,7 @@ export const ToolsMap = {
453
453
  }),
454
454
  [ToolType.TEXT_COLOR]: createTool({
455
455
  name: ToolType.TEXT_COLOR,
456
- render: Render.COLOR_PICKER,
456
+ render: WysiwygRender.COLOR_PICKER,
457
457
  icon: 'format-color-fill',
458
458
  title: 'Цвет',
459
459
  exec(value) {
@@ -465,7 +465,7 @@ export const ToolsMap = {
465
465
  }),
466
466
  [ToolType.FONT_FAMILY]: createTool({
467
467
  name: ToolType.FONT_FAMILY,
468
- render: Render.INPUT_AUTO,
468
+ render: WysiwygRender.INPUT_AUTO,
469
469
  title: 'Семейство шрифта',
470
470
  exec(value) {
471
471
  this.editor.commands.setFontFamily(value);
@@ -511,7 +511,7 @@ export const ToolsMap = {
511
511
  }),
512
512
  [ToolType.IMAGE]: createTool({
513
513
  name: ToolType.IMAGE,
514
- render: Render.IMAGE,
514
+ render: WysiwygRender.IMAGE,
515
515
  icon: 'image-plus',
516
516
  title: 'Изображение',
517
517
  async exec({ url = null, isResponsive, align, width, height }) {
@@ -615,7 +615,7 @@ export const ToolsMap = {
615
615
  }),
616
616
  [ToolType.LINK]: createTool({
617
617
  name: ToolType.LINK,
618
- render: Render.LINK,
618
+ render: WysiwygRender.LINK,
619
619
  icon: 'link-plus',
620
620
  title: 'Ссылка',
621
621
  getValue() {
@@ -694,7 +694,7 @@ export const ToolsMap = {
694
694
  }),
695
695
  [ToolType.TABLE]: createTool({
696
696
  name: ToolType.TABLE,
697
- render: Render.TOOLBAR_POPOVER,
697
+ render: WysiwygRender.TOOLBAR_POPOVER,
698
698
  icon: 'table-plus',
699
699
  title: 'таблица',
700
700
  options: Object.values(TableOptionsMap)
package/vue.config.js CHANGED
@@ -4,5 +4,5 @@ module.exports = {
4
4
  port: 3000
5
5
  },
6
6
  filenameHashing: true,
7
- lintOnSave: true
7
+ lintOnSave: false
8
8
  };