goodteditor-ui 1.0.26 → 1.0.27

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.
Files changed (116) hide show
  1. package/.eslintrc.js +7 -7
  2. package/.prettierrc +14 -14
  3. package/README.md +35 -35
  4. package/babel.config.js +5 -5
  5. package/index.js +53 -53
  6. package/jsconfig.json +13 -13
  7. package/package.json +67 -67
  8. package/src/App.vue +36 -36
  9. package/src/components/ui/Avatar.md +68 -68
  10. package/src/components/ui/Avatar.vue +180 -180
  11. package/src/components/ui/Badge.md +20 -20
  12. package/src/components/ui/Badge.vue +75 -75
  13. package/src/components/ui/Collapse.md +90 -90
  14. package/src/components/ui/Collapse.vue +86 -86
  15. package/src/components/ui/ColorPicker/Alpha.vue +114 -114
  16. package/src/components/ui/ColorPicker/Colors.vue +117 -117
  17. package/src/components/ui/ColorPicker/Hue.vue +113 -113
  18. package/src/components/ui/ColorPicker/Preview.vue +55 -55
  19. package/src/components/ui/ColorPicker/Saturation.vue +123 -123
  20. package/src/components/ui/ColorPicker/mixin.js +105 -105
  21. package/src/components/ui/ColorPicker.md +17 -17
  22. package/src/components/ui/ColorPicker.vue +314 -314
  23. package/src/components/ui/Datalist.md +41 -41
  24. package/src/components/ui/Datalist.vue +164 -164
  25. package/src/components/ui/DatePicker.md +168 -168
  26. package/src/components/ui/DatePicker.vue +527 -527
  27. package/src/components/ui/FileSelector.md +105 -105
  28. package/src/components/ui/FileSelector.vue +82 -82
  29. package/src/components/ui/Grid.md +130 -130
  30. package/src/components/ui/Grid.vue +92 -92
  31. package/src/components/ui/Image.md +59 -59
  32. package/src/components/ui/Image.vue +57 -57
  33. package/src/components/ui/InputAutocomplete.md +115 -115
  34. package/src/components/ui/InputAutocomplete.vue +349 -349
  35. package/src/components/ui/InputColorPicker.md +51 -51
  36. package/src/components/ui/InputColorPicker.vue +151 -151
  37. package/src/components/ui/InputDatePicker.md +121 -121
  38. package/src/components/ui/InputDatePicker.vue +326 -326
  39. package/src/components/ui/InputTags.md +51 -51
  40. package/src/components/ui/InputTags.vue +184 -184
  41. package/src/components/ui/InputTimePicker.md +25 -25
  42. package/src/components/ui/InputTimePicker.vue +253 -253
  43. package/src/components/ui/InputUnits.md +20 -20
  44. package/src/components/ui/InputUnits.vue +257 -257
  45. package/src/components/ui/Lazy.md +37 -37
  46. package/src/components/ui/Lazy.vue +92 -92
  47. package/src/components/ui/Pagination.md +74 -74
  48. package/src/components/ui/Pagination.vue +138 -138
  49. package/src/components/ui/Paginator.md +34 -34
  50. package/src/components/ui/Paginator.vue +83 -83
  51. package/src/components/ui/Popover.md +34 -34
  52. package/src/components/ui/Popover.vue +274 -274
  53. package/src/components/ui/Popup.md +59 -59
  54. package/src/components/ui/Popup.vue +150 -150
  55. package/src/components/ui/ResponsiveContainer.md +58 -58
  56. package/src/components/ui/ResponsiveContainer.vue +99 -99
  57. package/src/components/ui/Select.md +187 -187
  58. package/src/components/ui/Select.vue +421 -421
  59. package/src/components/ui/TimePicker.md +50 -50
  60. package/src/components/ui/TimePicker.vue +252 -252
  61. package/src/components/ui/Tooltip.md +54 -54
  62. package/src/components/ui/Tooltip.vue +113 -113
  63. package/src/components/ui/WysiwygEditor/WysiwygEditor.d.ts +128 -128
  64. package/src/components/ui/WysiwygEditor/constants.js +273 -273
  65. package/src/components/ui/WysiwygEditor/extensions/blockquote.js +15 -15
  66. package/src/components/ui/WysiwygEditor/extensions/bold.js +15 -15
  67. package/src/components/ui/WysiwygEditor/extensions/bullet-list.js +15 -15
  68. package/src/components/ui/WysiwygEditor/extensions/code-block.js +13 -13
  69. package/src/components/ui/WysiwygEditor/extensions/code.js +13 -13
  70. package/src/components/ui/WysiwygEditor/extensions/font-size.js +34 -34
  71. package/src/components/ui/WysiwygEditor/extensions/formatting.js +14 -14
  72. package/src/components/ui/WysiwygEditor/extensions/heading.js +13 -13
  73. package/src/components/ui/WysiwygEditor/extensions/horizontal-rule.js +15 -15
  74. package/src/components/ui/WysiwygEditor/extensions/image.js +37 -33
  75. package/src/components/ui/WysiwygEditor/extensions/index.d.ts +32 -32
  76. package/src/components/ui/WysiwygEditor/extensions/index.js +32 -32
  77. package/src/components/ui/WysiwygEditor/extensions/italic.js +15 -15
  78. package/src/components/ui/WysiwygEditor/extensions/link.js +16 -16
  79. package/src/components/ui/WysiwygEditor/extensions/list-item.js +15 -15
  80. package/src/components/ui/WysiwygEditor/extensions/ordered-list.js +15 -15
  81. package/src/components/ui/WysiwygEditor/extensions/paragraph.js +23 -23
  82. package/src/components/ui/WysiwygEditor/extensions/strike.js +15 -15
  83. package/src/components/ui/WysiwygEditor/extensions/table-cell.js +13 -13
  84. package/src/components/ui/WysiwygEditor/extensions/table-header.js +15 -15
  85. package/src/components/ui/WysiwygEditor/extensions/table-row.js +15 -15
  86. package/src/components/ui/WysiwygEditor/extensions/table.js +29 -29
  87. package/src/components/ui/WysiwygEditor/extensions/text-align.js +6 -6
  88. package/src/components/ui/WysiwygEditor/extensions/text-style.js +12 -12
  89. package/src/components/ui/WysiwygEditor/extensions/underline.js +15 -15
  90. package/src/components/ui/WysiwygEditor/index.d.ts +4 -4
  91. package/src/components/ui/WysiwygEditor/index.js +4 -4
  92. package/src/components/ui/WysiwygEditor/renders/Button.vue +28 -28
  93. package/src/components/ui/WysiwygEditor/renders/ColorPicker.vue +41 -41
  94. package/src/components/ui/WysiwygEditor/renders/Image.vue +200 -162
  95. package/src/components/ui/WysiwygEditor/renders/InputAuto.vue +34 -34
  96. package/src/components/ui/WysiwygEditor/renders/InputUnits.vue +37 -37
  97. package/src/components/ui/WysiwygEditor/renders/Link.vue +82 -82
  98. package/src/components/ui/WysiwygEditor/renders/Select.vue +47 -47
  99. package/src/components/ui/WysiwygEditor/renders/ToolbarPopover.vue +49 -49
  100. package/src/components/ui/WysiwygEditor/renders/components/Popover.vue +15 -0
  101. package/src/components/ui/WysiwygEditor/renders/components/WithPopover.vue +35 -35
  102. package/src/components/ui/WysiwygEditor/renders/index.d.ts +8 -8
  103. package/src/components/ui/WysiwygEditor/renders/index.js +8 -8
  104. package/src/components/ui/WysiwygEditor/renders/mixins/RenderMixin.js +39 -39
  105. package/src/components/ui/WysiwygEditor/renders/mixins/index.js +1 -1
  106. package/src/components/ui/WysiwygEditor/tools-and-commands.js +709 -702
  107. package/src/components/ui/WysiwygEditor/utils.js +72 -72
  108. package/src/components/ui/WysiwygEditor.md +18 -18
  109. package/src/components/ui/WysiwygEditor.vue +266 -266
  110. package/src/components/ui/utils/FormComponent.js +107 -107
  111. package/src/components/ui/utils/Helpers.js +84 -84
  112. package/src/components/ui/utils/WithPopover.js +81 -81
  113. package/src/main.js +8 -8
  114. package/styleguide.config.js +37 -37
  115. package/vue.config.js +8 -8
  116. package/dist/js.png +0 -0
@@ -1,162 +1,200 @@
1
- <template>
2
- <with-popover :show.sync="isPopoverShown" auto-width>
3
- <template #button="{ togglePopover }">
4
- <button :title="title" class="btn btn-small btn-outline btn-icon" @click="togglePopover">
5
- <div class="icon">
6
- <i class="mdi" :class="icon"></i>
7
- </div>
8
- </button>
9
- </template>
10
- <div class="w-f2">
11
- <div class="row row-hgap-3 mar-bot-l1">
12
- <div class="col col-vmid text-truncate">
13
- <div class="form-label form-label-xsmall text-truncate">Url</div>
14
- </div>
15
- <div class="col col-vmid col-12-12">
16
- <div class="form-control form-control-icon-right w-12-12">
17
- <input-autocomplete v-model.trim.lazy="image.url" size="small" @change="onChange" />
18
- <div class="icon">
19
- <i class="mdi mdi-folder cursor-pointer color-grey" @click="browse" />
20
- </div>
21
- </div>
22
- </div>
23
- </div>
24
-
25
- <div class="row row-hgap-3 mar-bot-l1">
26
- <div class="col col-vmid text-truncate">
27
- <label for="resp" class="form-label form-label-small text-truncate">
28
- Отзывчивое изображение
29
- </label>
30
- </div>
31
- <div class="col col-vmid col-auto">
32
- <input
33
- id="resp"
34
- v-model="image.isResponsive"
35
- type="checkbox"
36
- class="switch switch-small pull-right">
37
- </div>
38
- </div>
39
-
40
- <div class="row row-hgap-l1 mar-bot-l1">
41
- <div class="col">
42
- <div class="row row-hgap-3">
43
- <div class="col col-vmid text-truncate">
44
- <div class="form-label form-label-xsmall text-truncate">Ширина</div>
45
- </div>
46
- <div class="col col-vmid col-12-12">
47
- <input-units
48
- v-model="image.width"
49
- :units="$options.static.SizeUnits"
50
- :disabled="image.isResponsive"
51
- size="small"
52
- @change="onChange">
53
- </input-units>
54
- </div>
55
- </div>
56
- </div>
57
- <div class="col">
58
- <div class="row row-hgap-3">
59
- <div class="col col-vmid text-truncate">
60
- <div class="form-label form-label-xsmall text-truncate">Высота</div>
61
- </div>
62
- <div class="col col-vmid col-12-12">
63
- <input-units
64
- v-model="image.height"
65
- :units="$options.static.SizeUnits"
66
- :disabled="image.isResponsive"
67
- size="small"
68
- @change="onChange">
69
- </input-units>
70
- </div>
71
- </div>
72
- </div>
73
- </div>
74
- </div>
75
- </with-popover>
76
- </template>
77
-
78
- <script>
79
- import InputAutocomplete from '../../InputAutocomplete.vue';
80
- import InputUnits from '../../InputUnits.vue';
81
- import WithPopover from './components/WithPopover.vue';
82
- import { useRender } from './mixins';
83
-
84
- const SizeUnits = ["rem", "em", "%", "px", "vh", "vw"];
85
-
86
- const defaultImgSettings = {
87
- url: '',
88
- isResponsive: true,
89
- height: '100%',
90
- width: '100%'
91
- };
92
-
93
- const cssStrToObj = (str) => {
94
- if (str == null) {
95
- return {};
96
- }
97
- return str.split(';').reduce((obj, style) => {
98
- const [name, val] = style.split(':').map((el) => el.trim());
99
- if (name != null && val != null) {
100
- obj[name] = val;
101
- }
102
- return obj;
103
- }, {});
104
- }
105
-
106
- export default {
107
- components: {
108
- InputAutocomplete,
109
- InputUnits,
110
- WithPopover
111
- },
112
- mixins: [useRender()],
113
- data: () => ({
114
- isPopoverShown: false,
115
- image: { ...defaultImgSettings }
116
- }),
117
- watch: {
118
- isPopoverShown(isShown) {
119
- if (isShown === false) {
120
- this.image = { ...defaultImgSettings };
121
- return;
122
- }
123
-
124
- this.setImageSettings();
125
- }
126
- },
127
- static: {
128
- SizeUnits
129
- },
130
- methods: {
131
- setImageSettings() {
132
- const attrs = this.tool.getValue();
133
-
134
- if (JSON.stringify(attrs) === '{}') {
135
- return;
136
- }
137
-
138
- const { src: url, class: className, style } = attrs;
139
- const { width, height } = cssStrToObj(style);
140
-
141
- this.image = {
142
- ...defaultImgSettings,
143
- url,
144
- isResponsive: className?.includes?.('responsive') ?? false,
145
- ...(width && { width }),
146
- ...(height && { height })
147
- };
148
- },
149
- async browse() {
150
- await this.tool.exec(this.image);
151
- const { src: url } = this.tool.getValue();
152
-
153
- this.image = { ...this.image, url };
154
- this.emitExecuted();
155
- },
156
- onChange() {
157
- this.tool.exec(this.image);
158
- this.emitExecuted();
159
- }
160
- }
161
- };
162
- </script>
1
+ <template>
2
+ <with-popover :show.sync="isPopoverShown" auto-width>
3
+ <template #button="{ togglePopover }">
4
+ <button :title="title" class="btn btn-small btn-outline btn-icon" @click="togglePopover">
5
+ <div class="icon">
6
+ <i class="mdi" :class="icon"></i>
7
+ </div>
8
+ </button>
9
+ </template>
10
+ <template #default="{ togglePopover }">
11
+ <div class="w-f2">
12
+ <div class="row row-hgap-3 mar-bot-l1">
13
+ <div class="col col-vmid text-truncate">
14
+ <div class="form-label form-label-xsmall text-truncate">Url</div>
15
+ </div>
16
+ <div class="col col-vmid col-12-12">
17
+ <div class="form-control form-control-icon-right w-12-12">
18
+ <input-autocomplete
19
+ v-model.trim.lazy="image.url"
20
+ size="small"
21
+ @change="onChange" />
22
+ <div class="icon" @click="($event) => browse(togglePopover)">
23
+ <i class="mdi mdi-folder cursor-pointer color-grey" />
24
+ </div>
25
+ </div>
26
+ </div>
27
+ </div>
28
+
29
+ <div class="row row-hgap-3 mar-bot-l1">
30
+ <div class="col col-vmid text-truncate">
31
+ <label for="resp" class="form-label form-label-small text-truncate">
32
+ Отзывчивое изображение
33
+ </label>
34
+ </div>
35
+ <div class="col col-vmid col-auto">
36
+ <input
37
+ id="resp"
38
+ v-model="image.isResponsive"
39
+ type="checkbox"
40
+ class="switch switch-small pull-right"
41
+ @change="onChange">
42
+ </div>
43
+ </div>
44
+
45
+ <div class="row row-hgap-3 mar-bot-l1">
46
+ <div class="col col-vmid text-truncate">
47
+ <label class="form-label form-label-xsmall text-truncate">
48
+ Выровнять изображение
49
+ </label>
50
+ </div>
51
+ <div class="col col-vmid col-12-12">
52
+ <ui-select
53
+ v-model="image.align"
54
+ :options="$options.static.AlignOptions"
55
+ size="small"
56
+ class="w-100"
57
+ @change="onChange" />
58
+ </div>
59
+ </div>
60
+
61
+ <div class="row row-hgap-l1 mar-bot-l1">
62
+ <div class="col">
63
+ <div class="row row-hgap-3">
64
+ <div class="col col-vmid text-truncate">
65
+ <div class="form-label form-label-xsmall text-truncate">Ширина</div>
66
+ </div>
67
+ <div class="col col-vmid col-12-12">
68
+ <input-units
69
+ v-model="image.width"
70
+ :units="$options.static.SizeUnits"
71
+ :disabled="image.isResponsive"
72
+ size="small"
73
+ @change="onChange">
74
+ </input-units>
75
+ </div>
76
+ </div>
77
+ </div>
78
+ <div class="col">
79
+ <div class="row row-hgap-3">
80
+ <div class="col col-vmid text-truncate">
81
+ <div class="form-label form-label-xsmall text-truncate">Высота</div>
82
+ </div>
83
+ <div class="col col-vmid col-12-12">
84
+ <input-units
85
+ v-model="image.height"
86
+ :units="$options.static.SizeUnits"
87
+ :disabled="image.isResponsive"
88
+ size="small"
89
+ @change="onChange">
90
+ </input-units>
91
+ </div>
92
+ </div>
93
+ </div>
94
+ </div>
95
+ </div>
96
+ </template>
97
+ </with-popover>
98
+ </template>
99
+
100
+ <script>
101
+ import InputAutocomplete from '../../InputAutocomplete.vue';
102
+ import InputUnits from '../../InputUnits.vue';
103
+ import UiSelect from '../../Select.vue';
104
+ import WithPopover from './components/WithPopover.vue';
105
+ import { useRender } from './mixins';
106
+
107
+ const SizeUnits = ["rem", "em", "%", "px", "vh", "vw"];
108
+ const AlignOptions = [
109
+ { value: null, label: 'По левому краю' },
110
+ { value: 'mar-h-auto', label: 'По центру' },
111
+ { value: 'mar-left-auto', label: 'По правому краю' }
112
+ ];
113
+
114
+ const defaultImgSettings = {
115
+ url: '',
116
+ isResponsive: true,
117
+ align: null,
118
+ height: '100%',
119
+ width: '100%',
120
+ };
121
+
122
+ const cssStrToObj = (str) => {
123
+ if (str == null) {
124
+ return {};
125
+ }
126
+ return str.split(';').reduce((obj, style) => {
127
+ const [name, val] = style.split(':').map((el) => el.trim());
128
+ if (name != null && val != null) {
129
+ obj[name] = val;
130
+ }
131
+ return obj;
132
+ }, {});
133
+ }
134
+
135
+ export default {
136
+ components: {
137
+ InputAutocomplete,
138
+ InputUnits,
139
+ UiSelect,
140
+ WithPopover
141
+ },
142
+ mixins: [useRender()],
143
+ data: () => ({
144
+ isPopoverShown: false,
145
+ image: { ...defaultImgSettings }
146
+ }),
147
+ watch: {
148
+ isPopoverShown(isShown) {
149
+ if (isShown === false) {
150
+ this.image = { ...defaultImgSettings };
151
+ return;
152
+ }
153
+
154
+ this.setImageSettings();
155
+ }
156
+ },
157
+ static: {
158
+ SizeUnits,
159
+ AlignOptions
160
+ },
161
+ methods: {
162
+ setImageSettings() {
163
+ const attrs = this.tool.getValue();
164
+
165
+ if (JSON.stringify(attrs) === '{}') {
166
+ return;
167
+ }
168
+
169
+ const { src: url, class: className, style } = attrs;
170
+ const { width, height } = cssStrToObj(style);
171
+ const align = className.match(/mar-\w+-\w+/);
172
+
173
+ this.image = {
174
+ ...defaultImgSettings,
175
+ url,
176
+ isResponsive: className?.includes('responsive') ?? false,
177
+ align: align?.[0] ?? null,
178
+ ...(width && { width }),
179
+ ...(height && { height })
180
+ };
181
+ },
182
+ async browse(togglePopover) {
183
+ /* to avoid overlap with FileManager's popup */
184
+ togglePopover();
185
+
186
+ await this.tool.exec(this.image);
187
+ const { src: url } = this.tool.getValue();
188
+
189
+ this.image = { ...this.image, url };
190
+ this.emitExecuted();
191
+
192
+ togglePopover();
193
+ },
194
+ onChange() {
195
+ this.tool.exec(this.image);
196
+ this.emitExecuted();
197
+ }
198
+ }
199
+ };
200
+ </script>
@@ -1,34 +1,34 @@
1
- <template>
2
- <div :title="title" class="autocomplete-tool">
3
- <input-autocomplete
4
- v-bind="{ value, options: tool.options, disabled: !isEnabled, size: 'small' }"
5
- @input="onInput" />
6
- </div>
7
- </template>
8
-
9
- <script>
10
- import InputAutocomplete from '../../InputAutocomplete.vue';
11
- import { useRender } from './mixins';
12
-
13
- export default {
14
- components: { InputAutocomplete },
15
- mixins: [useRender()],
16
- computed: {
17
- value() {
18
- return this.tool.getValue() ?? '';
19
- }
20
- },
21
- methods: {
22
- onInput(value) {
23
- this.tool.exec(value);
24
- this.emitExecuted();
25
- }
26
- }
27
- };
28
- </script>
29
-
30
- <style scoped>
31
- .autocomplete-tool {
32
- width: 10rem;
33
- }
34
- </style>
1
+ <template>
2
+ <div :title="title" class="autocomplete-tool">
3
+ <input-autocomplete
4
+ v-bind="{ value, options: tool.options, disabled: !isEnabled, size: 'small' }"
5
+ @input="onInput" />
6
+ </div>
7
+ </template>
8
+
9
+ <script>
10
+ import InputAutocomplete from '../../InputAutocomplete.vue';
11
+ import { useRender } from './mixins';
12
+
13
+ export default {
14
+ components: { InputAutocomplete },
15
+ mixins: [useRender()],
16
+ computed: {
17
+ value() {
18
+ return this.tool.getValue() ?? '';
19
+ }
20
+ },
21
+ methods: {
22
+ onInput(value) {
23
+ this.tool.exec(value);
24
+ this.emitExecuted();
25
+ }
26
+ }
27
+ };
28
+ </script>
29
+
30
+ <style scoped>
31
+ .autocomplete-tool {
32
+ width: 10rem;
33
+ }
34
+ </style>
@@ -1,37 +1,37 @@
1
- <template>
2
- <div :title="title" class="input-units-tool">
3
- <input-units
4
- v-bind="{ value, units, size: 'small', disabled: !isEnabled }"
5
- @change="onChange" />
6
- </div>
7
- </template>
8
-
9
- <script>
10
- import InputUnits from '../../InputUnits.vue';
11
- import { useRender } from './mixins';
12
-
13
- export default {
14
- components: { InputUnits },
15
- mixins: [useRender()],
16
- computed: {
17
- value() {
18
- return this.tool.getValue();
19
- },
20
- units() {
21
- return this.tool?.units ?? [];
22
- }
23
- },
24
- methods: {
25
- onChange(value) {
26
- this.tool.exec(value);
27
- this.emitExecuted();
28
- }
29
- }
30
- };
31
- </script>
32
-
33
- <style scoped>
34
- .input-units-tool {
35
- width: 4rem;
36
- }
37
- </style>
1
+ <template>
2
+ <div :title="title" class="input-units-tool">
3
+ <input-units
4
+ v-bind="{ value, units, size: 'small', disabled: !isEnabled }"
5
+ @change="onChange" />
6
+ </div>
7
+ </template>
8
+
9
+ <script>
10
+ import InputUnits from '../../InputUnits.vue';
11
+ import { useRender } from './mixins';
12
+
13
+ export default {
14
+ components: { InputUnits },
15
+ mixins: [useRender()],
16
+ computed: {
17
+ value() {
18
+ return this.tool.getValue();
19
+ },
20
+ units() {
21
+ return this.tool?.units ?? [];
22
+ }
23
+ },
24
+ methods: {
25
+ onChange(value) {
26
+ this.tool.exec(value);
27
+ this.emitExecuted();
28
+ }
29
+ }
30
+ };
31
+ </script>
32
+
33
+ <style scoped>
34
+ .input-units-tool {
35
+ width: 4rem;
36
+ }
37
+ </style>