@progress/kendo-vue-editor 2.8.0-dev.202201111325 → 3.0.0-dev.202201161025

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 (58) hide show
  1. package/dist/cdn/js/kendo-vue-editor.js +1 -1
  2. package/dist/es/Editor.js +14 -9
  3. package/dist/es/config/toolsSettings.d.ts +4 -0
  4. package/dist/es/dialogs/FindReplace.d.ts +1 -1
  5. package/dist/es/dialogs/FindReplace.js +145 -115
  6. package/dist/es/dialogs/insertImage.js +20 -10
  7. package/dist/es/dialogs/insertLink.js +9 -5
  8. package/dist/es/main.d.ts +19 -0
  9. package/dist/es/main.js +19 -0
  10. package/dist/es/package-metadata.js +1 -1
  11. package/dist/es/tools/align.js +2 -2
  12. package/dist/es/tools/applyColor.js +6 -2
  13. package/dist/es/tools/cleanFormatting.js +2 -2
  14. package/dist/es/tools/findReplace.js +4 -4
  15. package/dist/es/tools/fontStyle.js +56 -20
  16. package/dist/es/tools/formatBlock.js +50 -16
  17. package/dist/es/tools/indent.js +2 -2
  18. package/dist/es/tools/inlineFormat.js +2 -2
  19. package/dist/es/tools/insertImage.js +2 -2
  20. package/dist/es/tools/insertLink.js +2 -2
  21. package/dist/es/tools/insertTable/tool.js +2 -2
  22. package/dist/es/tools/lists.js +2 -2
  23. package/dist/es/tools/outdent.js +2 -2
  24. package/dist/es/tools/pdf.js +2 -2
  25. package/dist/es/tools/print.js +2 -2
  26. package/dist/es/tools/proseMirrorTool.js +2 -2
  27. package/dist/es/tools/selectAll.js +2 -2
  28. package/dist/es/tools/unlink.js +2 -2
  29. package/dist/es/tools/viewHtml.js +2 -2
  30. package/dist/npm/Editor.js +13 -8
  31. package/dist/npm/config/toolsSettings.d.ts +4 -0
  32. package/dist/npm/dialogs/FindReplace.d.ts +1 -1
  33. package/dist/npm/dialogs/FindReplace.js +145 -115
  34. package/dist/npm/dialogs/insertImage.js +20 -10
  35. package/dist/npm/dialogs/insertLink.js +9 -5
  36. package/dist/npm/main.d.ts +19 -0
  37. package/dist/npm/main.js +38 -0
  38. package/dist/npm/package-metadata.js +1 -1
  39. package/dist/npm/tools/align.js +2 -2
  40. package/dist/npm/tools/applyColor.js +6 -2
  41. package/dist/npm/tools/cleanFormatting.js +2 -2
  42. package/dist/npm/tools/findReplace.js +4 -4
  43. package/dist/npm/tools/fontStyle.js +57 -20
  44. package/dist/npm/tools/formatBlock.js +51 -16
  45. package/dist/npm/tools/indent.js +2 -2
  46. package/dist/npm/tools/inlineFormat.js +2 -2
  47. package/dist/npm/tools/insertImage.js +2 -2
  48. package/dist/npm/tools/insertLink.js +2 -2
  49. package/dist/npm/tools/insertTable/tool.js +2 -2
  50. package/dist/npm/tools/lists.js +2 -2
  51. package/dist/npm/tools/outdent.js +2 -2
  52. package/dist/npm/tools/pdf.js +2 -2
  53. package/dist/npm/tools/print.js +2 -2
  54. package/dist/npm/tools/proseMirrorTool.js +2 -2
  55. package/dist/npm/tools/selectAll.js +2 -2
  56. package/dist/npm/tools/unlink.js +2 -2
  57. package/dist/npm/tools/viewHtml.js +2 -2
  58. package/package.json +12 -12
@@ -73,6 +73,8 @@ var InsertImageDialogVue2 = {
73
73
  }
74
74
  }, [localization.toLanguageString(insertImageAddress, messages[insertImageAddress])])]), h("div", {
75
75
  "class": "k-edit-field"
76
+ }, [h("span", {
77
+ "class": "k-textbox k-input k-input-md k-rounded-md k-input-solid"
76
78
  }, [h("input", {
77
79
  type: "text",
78
80
  attrs: this.v3 ? undefined : {
@@ -80,7 +82,7 @@ var InsertImageDialogVue2 = {
80
82
  id: "k-editor-image-url",
81
83
  autoFocus: true
82
84
  },
83
- "class": "k-input",
85
+ "class": "k-input-inner",
84
86
  id: "k-editor-image-url",
85
87
  value: this.v3 ? attrs.src : null,
86
88
  domProps: this.v3 ? undefined : {
@@ -90,7 +92,7 @@ var InsertImageDialogVue2 = {
90
92
  _this.srcRef = el;
91
93
  } : 'src',
92
94
  autoFocus: true
93
- })]), h("div", {
95
+ })])]), h("div", {
94
96
  "class": "k-edit-label"
95
97
  }, [h("label", {
96
98
  "for": "k-editor-image-alt",
@@ -99,13 +101,15 @@ var InsertImageDialogVue2 = {
99
101
  }
100
102
  }, [localization.toLanguageString(insertImageAltText, messages[insertImageAltText])])]), h("div", {
101
103
  "class": "k-edit-field"
104
+ }, [h("span", {
105
+ "class": "k-textbox k-input k-input-md k-rounded-md k-input-solid"
102
106
  }, [h("input", {
103
107
  type: "text",
104
108
  attrs: this.v3 ? undefined : {
105
109
  type: "text",
106
110
  id: "k-editor-image-alt"
107
111
  },
108
- "class": "k-input",
112
+ "class": "k-input-inner",
109
113
  id: "k-editor-image-alt",
110
114
  value: this.v3 ? attrs.alt : null,
111
115
  domProps: this.v3 ? undefined : {
@@ -114,7 +118,7 @@ var InsertImageDialogVue2 = {
114
118
  ref: this.v3 ? function (el) {
115
119
  _this.altTextRef = el;
116
120
  } : 'altText'
117
- })]), h("div", {
121
+ })])]), h("div", {
118
122
  "class": "k-edit-label"
119
123
  }, [h("label", {
120
124
  "for": "k-editor-image-title",
@@ -123,13 +127,15 @@ var InsertImageDialogVue2 = {
123
127
  }
124
128
  }, [localization.toLanguageString(insertImageTitle, messages[insertImageTitle])])]), h("div", {
125
129
  "class": "k-edit-field"
130
+ }, [h("span", {
131
+ "class": "k-textbox k-input k-input-md k-rounded-md k-input-solid"
126
132
  }, [h("input", {
127
133
  type: "text",
128
134
  attrs: this.v3 ? undefined : {
129
135
  type: "text",
130
136
  id: "k-editor-image-title"
131
137
  },
132
- "class": "k-input",
138
+ "class": "k-input-inner",
133
139
  id: "k-editor-image-title",
134
140
  value: this.v3 ? attrs.title : null,
135
141
  domProps: this.v3 ? undefined : {
@@ -138,7 +144,7 @@ var InsertImageDialogVue2 = {
138
144
  ref: this.v3 ? function (el) {
139
145
  _this.titleRef = el;
140
146
  } : 'title'
141
- })]), h("div", {
147
+ })])]), h("div", {
142
148
  "class": "k-edit-label"
143
149
  }, [h("label", {
144
150
  "for": "k-editor-image-width",
@@ -147,13 +153,15 @@ var InsertImageDialogVue2 = {
147
153
  }
148
154
  }, [localization.toLanguageString(insertImageWidth, messages[insertImageWidth])])]), h("div", {
149
155
  "class": "k-edit-field"
156
+ }, [h("span", {
157
+ "class": "k-textbox k-input k-input-md k-rounded-md k-input-solid"
150
158
  }, [h("input", {
151
159
  type: "text",
152
160
  attrs: this.v3 ? undefined : {
153
161
  type: "text",
154
162
  id: "k-editor-image-width"
155
163
  },
156
- "class": "k-input",
164
+ "class": "k-input-inner",
157
165
  id: "k-editor-image-width",
158
166
  value: this.v3 ? attrs.width : null,
159
167
  domProps: this.v3 ? undefined : {
@@ -162,7 +170,7 @@ var InsertImageDialogVue2 = {
162
170
  ref: this.v3 ? function (el) {
163
171
  _this.widthRef = el;
164
172
  } : 'width'
165
- })]), h("div", {
173
+ })])]), h("div", {
166
174
  "class": "k-edit-label"
167
175
  }, [h("label", {
168
176
  "for": "k-editor-image-height",
@@ -171,13 +179,15 @@ var InsertImageDialogVue2 = {
171
179
  }
172
180
  }, [localization.toLanguageString(insertImageHeight, messages[insertImageHeight])])]), h("div", {
173
181
  "class": "k-edit-field"
182
+ }, [h("span", {
183
+ "class": "k-textbox k-input k-input-md k-rounded-md k-input-solid"
174
184
  }, [h("input", {
175
185
  type: "text",
176
186
  attrs: this.v3 ? undefined : {
177
187
  type: "text",
178
188
  id: "k-editor-image-height"
179
189
  },
180
- "class": "k-input",
190
+ "class": "k-input-inner",
181
191
  id: "k-editor-image-height",
182
192
  value: this.v3 ? attrs.height : null,
183
193
  domProps: this.v3 ? undefined : {
@@ -186,7 +196,7 @@ var InsertImageDialogVue2 = {
186
196
  ref: this.v3 ? function (el) {
187
197
  _this.heightRef = el;
188
198
  } : 'height'
189
- })])]);
199
+ })])])]);
190
200
  var actionButtons = [// @ts-ignore function children
191
201
  h(KButton, {
192
202
  onClick: this.onClose,
@@ -63,6 +63,8 @@ var InsertLinkDialogVue2 = {
63
63
  }
64
64
  }, [localization.toLanguageString(insertHyperlinkAddress, messages[insertHyperlinkAddress])])]), h("div", {
65
65
  "class": "k-edit-field"
66
+ }, [h("span", {
67
+ "class": "k-textbox k-input k-input-md k-rounded-md k-input-solid"
66
68
  }, [h("input", {
67
69
  type: "text",
68
70
  attrs: this.v3 ? undefined : {
@@ -70,7 +72,7 @@ var InsertLinkDialogVue2 = {
70
72
  id: "k-editor-link-url",
71
73
  autoFocus: true
72
74
  },
73
- "class": "k-input",
75
+ "class": "k-input-inner",
74
76
  ref: this.v3 ? function (el) {
75
77
  _this.hrefRef = el;
76
78
  } : 'href',
@@ -80,7 +82,7 @@ var InsertLinkDialogVue2 = {
80
82
  "value": linkMark && linkMark.attrs.href || undefined
81
83
  },
82
84
  autoFocus: true
83
- })]), h("div", {
85
+ })])]), h("div", {
84
86
  "class": "k-edit-label k-editor-link-text-row"
85
87
  }, [h("label", {
86
88
  "for": "k-editor-link-text",
@@ -89,13 +91,15 @@ var InsertLinkDialogVue2 = {
89
91
  }
90
92
  }, [localization.toLanguageString(insertHyperlinkTitle, messages[insertHyperlinkTitle])])]), h("div", {
91
93
  "class": "k-edit-field k-editor-link-text-row"
94
+ }, [h("span", {
95
+ "class": "k-textbox k-input k-input-md k-rounded-md k-input-solid"
92
96
  }, [h("input", {
93
97
  type: "text",
94
98
  attrs: this.v3 ? undefined : {
95
99
  type: "text",
96
100
  id: "k-editor-link-text"
97
101
  },
98
- "class": "k-input",
102
+ "class": "k-input-inner",
99
103
  id: "k-editor-link-text",
100
104
  ref: this.v3 ? function (el) {
101
105
  _this.titleRef = el;
@@ -104,7 +108,7 @@ var InsertLinkDialogVue2 = {
104
108
  domProps: this.v3 ? undefined : {
105
109
  "value": linkMark && linkMark.attrs.title || undefined
106
110
  }
107
- })]), settings.linkTarget !== false && h("div", {
111
+ })])]), settings.linkTarget !== false && h("div", {
108
112
  "class": "k-edit-field"
109
113
  }, [h("input", {
110
114
  type: "checkbox",
@@ -112,7 +116,7 @@ var InsertLinkDialogVue2 = {
112
116
  type: "checkbox",
113
117
  id: "k-editor-link-target"
114
118
  },
115
- "class": "k-checkbox",
119
+ "class": "k-checkbox k-checkbox-md k-rounded-md",
116
120
  id: "k-editor-link-target",
117
121
  ref: this.v3 ? function (el) {
118
122
  _this.targetRef = el;
package/dist/es/main.d.ts CHANGED
@@ -163,4 +163,23 @@ export declare const ProseMirror: {
163
163
  goToNextCell: typeof goToNextCell;
164
164
  deleteTable: typeof deleteTable;
165
165
  };
166
+ export { Align } from './tools/align';
167
+ export { Indent } from './tools/indent';
168
+ export { List } from './tools/lists';
169
+ export { Outdent } from './tools/outdent';
170
+ export { InlineFormat } from './tools/inlineFormat';
171
+ export { FontName } from './tools/fontStyle';
172
+ export { FormatBlock } from './tools/formatBlock';
173
+ export { ProseMirror as ProseMirrorTool } from './tools/proseMirrorTool';
174
+ export { LinkTool } from './tools/insertLink';
175
+ export { Unlink } from './tools/unlink';
176
+ export { CleanFormatting } from './tools/cleanFormatting';
177
+ export { SelectAll } from './tools/selectAll';
178
+ export { InsertImage } from './tools/insertImage';
179
+ export { InsertTable } from './tools/insertTable/tool';
180
+ export { ViewHtml } from './tools/viewHtml';
181
+ export { Pdf } from './tools/pdf';
182
+ export { Print } from './tools/print';
183
+ export { FindAndReplace } from './tools/findReplace';
184
+ export { ApplyColor } from './tools/applyColor';
166
185
  export { Editor, EditorProps, EditorMountEvent, EditorPasteEvent, EditorChangeEvent, EditorExecuteEvent, EditorFocusEvent, EditorBlurEvent, EditorTools, EditorToolsSettings, EditorUtils };
package/dist/es/main.js CHANGED
@@ -107,4 +107,23 @@ export var ProseMirror = {
107
107
  goToNextCell: goToNextCell,
108
108
  deleteTable: deleteTable
109
109
  };
110
+ export { Align } from './tools/align';
111
+ export { Indent } from './tools/indent';
112
+ export { List } from './tools/lists';
113
+ export { Outdent } from './tools/outdent';
114
+ export { InlineFormat } from './tools/inlineFormat';
115
+ export { FontName } from './tools/fontStyle';
116
+ export { FormatBlock } from './tools/formatBlock';
117
+ export { ProseMirror as ProseMirrorTool } from './tools/proseMirrorTool';
118
+ export { LinkTool } from './tools/insertLink';
119
+ export { Unlink } from './tools/unlink';
120
+ export { CleanFormatting } from './tools/cleanFormatting';
121
+ export { SelectAll } from './tools/selectAll';
122
+ export { InsertImage } from './tools/insertImage';
123
+ export { InsertTable } from './tools/insertTable/tool';
124
+ export { ViewHtml } from './tools/viewHtml';
125
+ export { Pdf } from './tools/pdf';
126
+ export { Print } from './tools/print';
127
+ export { FindAndReplace } from './tools/findReplace';
128
+ export { ApplyColor } from './tools/applyColor';
110
129
  export { Editor, EditorToolsSettings, EditorUtils };
@@ -5,7 +5,7 @@ export var packageMetadata = {
5
5
  name: '@progress/kendo-vue-editor',
6
6
  productName: 'Kendo UI for Vue',
7
7
  productCodes: ['KENDOUIVUE', 'KENDOUICOMPLETE'],
8
- publishDate: 1641906930,
8
+ publishDate: 1642328162,
9
9
  version: '',
10
10
  licensingDocsUrl: 'https://www.telerik.com/kendo-vue-ui/my-license/?utm_medium=product&utm_source=kendovue&utm_campaign=kendo-ui-vue-purchase-license-keys-warning'
11
11
  };
@@ -77,11 +77,11 @@ var AlignVue2 = {
77
77
  var localization = provideLocalizationService(this);
78
78
  var titleKey = settings.messages.title;
79
79
 
80
- var buttonProps = __assign(__assign(__assign({}, other), settings.props), {
80
+ var buttonProps = __assign(__assign(__assign({}, other), {
81
81
  selected: aligned,
82
82
  togglable: true,
83
83
  title: localization.toLanguageString(titleKey, messages[titleKey])
84
- });
84
+ }), settings.props);
85
85
 
86
86
  var button = h(kbutton, __assign({
87
87
  onClick: this.handleClick,
@@ -29,7 +29,8 @@ var ApplyColorVue2 = {
29
29
  view: Object,
30
30
  color: String,
31
31
  colorPickerProps: Object,
32
- commandName: String
32
+ commandName: String,
33
+ dir: String
33
34
  },
34
35
  inject: {
35
36
  kendoLocalizationService: {
@@ -46,11 +47,14 @@ var ApplyColorVue2 = {
46
47
  // @ts-ignore
47
48
  render: function render(createElement) {
48
49
  var h = gh || createElement;
49
- var colorPickerProps = this.$props.colorPickerProps;
50
+ var _a = this.$props,
51
+ colorPickerProps = _a.colorPickerProps,
52
+ dir = _a.dir;
50
53
  var titleKey = colorPickerProps.title;
51
54
  var localization = provideLocalizationService(this);
52
55
 
53
56
  var cpProps = __assign(__assign({}, colorPickerProps), {
57
+ dir: dir,
54
58
  title: titleKey ? localization.toLanguageString(titleKey, messages[titleKey]) : titleKey
55
59
  });
56
60
 
@@ -75,10 +75,10 @@ var CleanFormattingVue2 = {
75
75
  var titleKey = settings.messages.title;
76
76
  var localization = provideLocalizationService(this);
77
77
 
78
- var buttonProps = __assign(__assign(__assign({}, other), settings.props), {
78
+ var buttonProps = __assign(__assign(__assign({}, other), {
79
79
  disabled: !view || !command(view.state),
80
80
  title: localization.toLanguageString(titleKey, messages[titleKey])
81
- });
81
+ }), settings.props);
82
82
 
83
83
  var button = h(kbutton, __assign({
84
84
  onClick: this.handleClick,
@@ -71,11 +71,11 @@ var FindAndReplaceVue2 = {
71
71
  var localization = provideLocalizationService(this);
72
72
  var titleKey = settings.messages.findReplaceToolTitle;
73
73
 
74
- var buttonProps = __assign(__assign(__assign({}, other), settings.props), {
74
+ var buttonProps = __assign(__assign(__assign({}, other), {
75
75
  key: 'tool',
76
76
  disabled: !view,
77
77
  title: localization.toLanguageString(titleKey, messages[titleKey])
78
- });
78
+ }), settings.props);
79
79
 
80
80
  var button = h(kbutton, __assign({
81
81
  onClick: this.onOpen,
@@ -93,13 +93,13 @@ var FindAndReplaceVue2 = {
93
93
  view: view,
94
94
  attrs: this.v3 ? undefined : {
95
95
  view: view,
96
- dir: buttonProps.dir
96
+ dir: this.$props.dir
97
97
  },
98
98
  onClose: this.onClose,
99
99
  on: this.v3 ? undefined : {
100
100
  "close": this.onClose
101
101
  },
102
- dir: buttonProps.dir,
102
+ dir: this.$props.dir,
103
103
  key: "dialog"
104
104
  })]);
105
105
  },
@@ -47,6 +47,7 @@ var allVue = Vue;
47
47
  var gh = allVue.h;
48
48
  import { DropDownList } from '@progress/kendo-vue-dropdowns';
49
49
  import { getInlineStyles, applyInlineStyle } from '@progress/kendo-editor-common';
50
+ import { Keys } from '@progress/kendo-vue-common';
50
51
  import { userSelectNone } from './utils';
51
52
  import { provideLocalizationService } from '@progress/kendo-vue-intl';
52
53
  import { messages } from './../messages'; // tslint:enable:max-line-length
@@ -76,6 +77,30 @@ var FontNameVue2 = {
76
77
  v3: v3
77
78
  };
78
79
  },
80
+ data: function data() {
81
+ return {
82
+ currentValue: null,
83
+ currentOpened: false
84
+ };
85
+ },
86
+ computed: {
87
+ computedValue: function computedValue() {
88
+ var _a = this.$props,
89
+ view = _a.view,
90
+ settings = _a.settings,
91
+ dataItems = _a.dataItems;
92
+ var style = settings.style;
93
+ var items = dataItems || settings.items;
94
+ var styles = view ? getInlineStyles(view.state, {
95
+ name: style,
96
+ value: /^.+$/
97
+ }) : [];
98
+ var value = new Set(styles).size === 1 ? styles[0] : null;
99
+ return this.currentValue ? this.currentValue : value ? items.find(function (i) {
100
+ return i.value === value;
101
+ }) : value;
102
+ }
103
+ },
79
104
  // @ts-ignore
80
105
  render: function render(createElement) {
81
106
  var h = gh || createElement;
@@ -88,13 +113,8 @@ var FontNameVue2 = {
88
113
  defaultItemProps = _a.defaultItem,
89
114
  other = __rest(_a, ["view", "render", "dataItems", "settings", "defaultItem"]);
90
115
 
91
- var style = settings.style;
92
116
  var items = dataItems || settings.items;
93
117
  var defaultItem = defaultItemProps || settings.defaultItem;
94
- var styles = view ? getInlineStyles(view.state, {
95
- name: style,
96
- value: /^.+$/
97
- }) : [];
98
118
  var localization = provideLocalizationService(this);
99
119
 
100
120
  if (defaultItem && defaultItem.localizationKey) {
@@ -102,25 +122,25 @@ var FontNameVue2 = {
102
122
  defaultItem.text = defaultItem.localizationKey ? localization.toLanguageString(defaultItem.localizationKey, messages[defaultItem.localizationKey]) : defaultItem.text;
103
123
  }
104
124
 
105
- var value = new Set(styles).size === 1 ? styles[0] : null;
106
-
107
- var ddlProps = __assign(__assign(__assign({}, other), settings.props), {
108
- value: value ? items.find(function (i) {
109
- return i.value === value;
110
- }) : value,
125
+ var ddlProps = __assign(__assign(__assign({}, other), {
126
+ value: this.computedValue,
111
127
  dataItems: items,
112
128
  defaultItem: defaultItem,
113
129
  itemRender: this.customItemRender,
114
130
  textField: 'text',
115
131
  dataItemKey: 'value',
116
132
  leftRightKeysNavigation: false
117
- });
133
+ }), settings.props);
118
134
 
119
135
  var dropdown = h(DropDownList, __assign({
120
136
  onChange: this.onChange,
121
137
  on: this.v3 ? undefined : {
122
- 'change': this.onChange
138
+ 'change': this.onChange,
139
+ 'close': this.onClose,
140
+ 'open': this.onOpen
123
141
  },
142
+ onClose: this.onClose,
143
+ onOpen: this.onOpen,
124
144
  style: userSelectNone,
125
145
  attrs: this.v3 ? undefined : ddlProps
126
146
  }, ddlProps));
@@ -139,23 +159,39 @@ var FontNameVue2 = {
139
159
  }, __spreadArrays(li.children))]) : li;
140
160
  },
141
161
  onChange: function onChange(e) {
142
- var item = e.target.value;
143
162
  var _a = this.$props,
144
163
  view = _a.view,
145
164
  settings = _a.settings;
146
165
  var style = settings.style;
147
166
 
148
- if (view && item) {
167
+ if (!this.currentOpened) {
149
168
  applyInlineStyle({
150
169
  style: style,
151
- value: item.value
170
+ value: e.target.value.value
152
171
  }, settings.commandName)(view.state, view.dispatch);
153
- var event_1 = e.event;
172
+ view.focus();
173
+ this.currentValue = null;
174
+ } else {
175
+ this.currentValue = e.target.value;
176
+ }
177
+ },
178
+ onClose: function onClose(e) {
179
+ var _a = this.$props,
180
+ view = _a.view,
181
+ settings = _a.settings;
182
+ var style = settings.style;
154
183
 
155
- if (event_1 && event_1.type === 'click') {
156
- view.focus();
157
- }
184
+ if (view && this.computedValue && (e.event.type === 'click' || e.event.keyCode && e.event.keyCode === Keys.enter)) {
185
+ applyInlineStyle({
186
+ style: style,
187
+ value: this.computedValue.value
188
+ }, settings.commandName)(view.state, view.dispatch);
189
+ view.focus();
190
+ this.currentValue = null;
158
191
  }
192
+ },
193
+ onOpen: function onOpen() {
194
+ this.currentOpened = true;
159
195
  }
160
196
  }
161
197
  };
@@ -47,6 +47,7 @@ var allVue = Vue;
47
47
  var gh = allVue.h;
48
48
  import { DropDownList } from '@progress/kendo-vue-dropdowns';
49
49
  import { getBlockFormats, formatBlockElements } from '@progress/kendo-editor-common';
50
+ import { Keys } from '@progress/kendo-vue-common';
50
51
  import { userSelectNone } from './utils';
51
52
  import { provideLocalizationService } from '@progress/kendo-vue-intl';
52
53
  import { messages } from './../messages'; // tslint:enable:max-line-length
@@ -69,6 +70,27 @@ var FormatBlockVue2 = {
69
70
  default: null
70
71
  }
71
72
  },
73
+ data: function data() {
74
+ return {
75
+ currentValue: null,
76
+ currentOpened: false
77
+ };
78
+ },
79
+ computed: {
80
+ computedValue: function computedValue() {
81
+ var _a = this.$props,
82
+ view = _a.view,
83
+ settings = _a.settings,
84
+ dataItems = _a.dataItems;
85
+ var items = dataItems || settings.items;
86
+ var state = view && view.state;
87
+ var formats = state ? getBlockFormats(state) : [];
88
+ var value = new Set(formats).size === 1 ? formats[0] : null;
89
+ return this.currentValue ? this.currentValue : value ? items.find(function (i) {
90
+ return i.value === value;
91
+ }) : value;
92
+ }
93
+ },
72
94
  // @ts-ignore
73
95
  setup: !gh ? undefined : function () {
74
96
  var v3 = !!gh;
@@ -90,8 +112,6 @@ var FormatBlockVue2 = {
90
112
 
91
113
  var items = dataItems || settings.items;
92
114
  var defaultItem = defaultItemProps || settings.defaultItem;
93
- var state = view && view.state;
94
- var formats = state ? getBlockFormats(state) : [];
95
115
  var localization = provideLocalizationService(this);
96
116
 
97
117
  if (defaultItem && defaultItem.localizationKey) {
@@ -99,25 +119,25 @@ var FormatBlockVue2 = {
99
119
  defaultItem.text = defaultItem.localizationKey ? localization.toLanguageString(defaultItem.localizationKey, messages[defaultItem.localizationKey]) : defaultItem.text;
100
120
  }
101
121
 
102
- var value = new Set(formats).size === 1 ? formats[0] : null;
103
-
104
- var ddlProps = __assign(__assign(__assign({}, other), settings.props), {
105
- value: value ? items.find(function (i) {
106
- return i.value === value;
107
- }) : value,
122
+ var ddlProps = __assign(__assign(__assign({}, other), {
123
+ value: this.computedValue,
108
124
  dataItems: items,
109
125
  defaultItem: defaultItem,
110
126
  itemRender: this.customItemRender,
111
127
  textField: 'text',
112
128
  dataItemKey: 'value',
113
129
  leftRightKeysNavigation: false
114
- });
130
+ }), settings.props);
115
131
 
116
132
  var dropdown = h(DropDownList, __assign({
117
133
  onChange: this.onChange,
118
134
  on: this.v3 ? undefined : {
119
- 'change': this.onChange
135
+ 'change': this.onChange,
136
+ 'close': this.onClose,
137
+ 'open': this.onOpen
120
138
  },
139
+ onClose: this.onClose,
140
+ onOpen: this.onOpen,
121
141
  style: userSelectNone,
122
142
  attrs: this.v3 ? undefined : ddlProps
123
143
  }, ddlProps));
@@ -136,18 +156,32 @@ var FormatBlockVue2 = {
136
156
  }, __spreadArrays(li.children))]) : li;
137
157
  },
138
158
  onChange: function onChange(e) {
139
- var item = e.target.value;
140
159
  var _a = this.$props,
141
160
  view = _a.view,
142
161
  settings = _a.settings;
143
162
 
144
- if (view && formatBlockElements(item.value, settings.commandName)(view.state, view.dispatch)) {
145
- var event_1 = e.event;
163
+ if (!this.currentOpened) {
164
+ formatBlockElements(e.target.value.value, settings.commandName)(view.state, view.dispatch);
165
+ view.focus();
166
+ this.currentValue = null;
167
+ } else {
168
+ this.currentValue = e.target.value;
169
+ }
170
+ },
171
+ onClose: function onClose(e) {
172
+ var _a = this.$props,
173
+ view = _a.view,
174
+ settings = _a.settings;
175
+ this.currentOpened = false;
146
176
 
147
- if (event_1 && event_1.type === 'click') {
148
- view.focus();
149
- }
177
+ if (view && this.computedValue && (e.event.type === 'click' || e.event.keyCode && e.event.keyCode === Keys.enter)) {
178
+ formatBlockElements(this.computedValue.value, settings.commandName)(view.state, view.dispatch);
179
+ view.focus();
180
+ this.currentValue = null;
150
181
  }
182
+ },
183
+ onOpen: function onOpen() {
184
+ this.currentOpened = true;
151
185
  }
152
186
  }
153
187
  };
@@ -83,10 +83,10 @@ var IndentVue2 = {
83
83
  var localization = provideLocalizationService(this);
84
84
  var titleKey = settings.messages.title;
85
85
 
86
- var buttonProps = __assign(__assign(__assign({}, other), settings.props), {
86
+ var buttonProps = __assign(__assign(__assign({}, other), {
87
87
  disabled: !canIndent,
88
88
  title: localization.toLanguageString(titleKey, messages[titleKey])
89
- });
89
+ }), settings.props);
90
90
 
91
91
  var button = h(kbutton, __assign({
92
92
  onClick: this.handleClick,
@@ -83,11 +83,11 @@ var InlineFormatVue2 = {
83
83
  var localization = provideLocalizationService(this);
84
84
  var titleKey = settings.messages.title;
85
85
 
86
- var buttonProps = __assign(__assign(__assign({}, other), settings.props), {
86
+ var buttonProps = __assign(__assign(__assign({}, other), {
87
87
  selected: !!state && hasMark(state, options),
88
88
  togglable: true,
89
89
  title: localization.toLanguageString(titleKey, messages[titleKey])
90
- });
90
+ }), settings.props);
91
91
 
92
92
  var button = h(kbutton, __assign({
93
93
  onClick: this.handleClick,
@@ -82,11 +82,11 @@ var InsertImageVue2 = {
82
82
  var localization = provideLocalizationService(this);
83
83
  var insertImage = settings.messages.insertImage;
84
84
 
85
- var buttonProps = __assign(__assign(__assign({}, other), settings.props), {
85
+ var buttonProps = __assign(__assign(__assign({}, other), {
86
86
  key: 'insertImage',
87
87
  disabled: !nodeType || !state || !canInsert(state, nodeType),
88
88
  title: localization.toLanguageString(insertImage, messages[insertImage])
89
- });
89
+ }), settings.props);
90
90
 
91
91
  var button = h(kbutton, __assign({
92
92
  onClick: this.toggleDialog,
@@ -82,11 +82,11 @@ var LinkToolVue2 = {
82
82
  var localization = provideLocalizationService(this);
83
83
  var insertHyperlink = settings.messages.insertHyperlink;
84
84
 
85
- var buttonProps = __assign(__assign(__assign({}, other), settings.props), {
85
+ var buttonProps = __assign(__assign(__assign({}, other), {
86
86
  key: 'link',
87
87
  disabled: collapsed && !linkMark,
88
88
  title: localization.toLanguageString(insertHyperlink, messages[insertHyperlink])
89
- });
89
+ }), settings.props);
90
90
 
91
91
  var button = h(kbutton, __assign({
92
92
  onClick: this.toggleDialog,
@@ -89,11 +89,11 @@ var InsertTableVue2 = {
89
89
  var createTableMsg = localization.toLanguageString(createTableMsgKey, messages[createTableMsgKey]);
90
90
  var createTableHintMsg = localization.toLanguageString(createTableHint, messages[createTableHint]);
91
91
 
92
- var buttonProps = __assign(__assign(__assign({}, other), settings.props), {
92
+ var buttonProps = __assign(__assign(__assign({}, other), {
93
93
  disabled: !state || !canInsert(state, state.schema.nodes.table),
94
94
  key: 'InsertTable',
95
95
  title: createTableMsg
96
- });
96
+ }), settings.props);
97
97
 
98
98
  var button = h(KButton, __assign({
99
99
  ref: this.buttonRef,
@@ -90,11 +90,11 @@ var ListVue2 = {
90
90
  }
91
91
  }
92
92
 
93
- var buttonProps = __assign(__assign(__assign({}, other), settings.props), {
93
+ var buttonProps = __assign(__assign(__assign({}, other), {
94
94
  selected: isActive,
95
95
  togglable: true,
96
96
  title: localization.toLanguageString(titleKey, messages[titleKey])
97
- });
97
+ }), settings.props);
98
98
 
99
99
  var button = h(kbutton, __assign({
100
100
  onClick: this.handleClick,