vue-editify 0.1.29 → 0.1.31

Sign up to get free protection for your applications and to get access to all the features.
package/examples/App.vue CHANGED
@@ -19,10 +19,30 @@ const menuConfig = ref<MenuConfigType>({
19
19
  }
20
20
  })
21
21
 
22
+ //自定义插件
23
+ const redPlugin = () => {
24
+ const plugin: PluginType = () => {
25
+ return {
26
+ name: 'red',
27
+ renderRule: (el: AlexElement) => {
28
+ if (el.hasStyles()) {
29
+ el.styles!['color'] = 'red'
30
+ } else {
31
+ el.styles = {
32
+ color: 'red'
33
+ }
34
+ }
35
+ return el
36
+ }
37
+ }
38
+ }
39
+ return plugin
40
+ }
22
41
  const plugins = ref<PluginType[]>([
23
42
  attachment({
24
43
  multiple: true
25
- })
44
+ }),
45
+ redPlugin()
26
46
  ])
27
47
  </script>
28
48
  <style lang="less">
package/lib/editify.es.js CHANGED
@@ -19890,6 +19890,14 @@ const preHandle = function(editor, element2, highlight2, languages2) {
19890
19890
  newEl.parent = element2;
19891
19891
  });
19892
19892
  updateRangeInPre(editor, element2, originalTextElements, newElements);
19893
+ } else {
19894
+ const breakElement = new AlexElement("closed", "br", null, null, null);
19895
+ element2.children = [breakElement];
19896
+ breakElement.parent = element2;
19897
+ if (editor.range) {
19898
+ editor.range.anchor.moveToStart(breakElement);
19899
+ editor.range.focus.moveToStart(breakElement);
19900
+ }
19893
19901
  }
19894
19902
  }
19895
19903
  }
@@ -23942,6 +23950,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
23942
23950
  const value_isRangeInOrderList = isRangeInList(editor.value, dataRangeCaches.value, true);
23943
23951
  const value_isRangeInUnorderList = isRangeInList(editor.value, dataRangeCaches.value, false);
23944
23952
  const value_isRangeInTask = isRangeInTask(editor.value, dataRangeCaches.value);
23953
+ const value_hasImageInRange = hasImageInRange(editor.value, dataRangeCaches.value);
23954
+ const value_hasVideoInRange = hasVideoInRange(editor.value, dataRangeCaches.value);
23945
23955
  const extraDisabled = (name) => {
23946
23956
  let pluginDisabled = false;
23947
23957
  let length = pluginResultList.value.length;
@@ -24063,7 +24073,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
24063
24073
  videoConfig.value.disabled = value_hasPreInRange || extraDisabled("video");
24064
24074
  tableConfig.value.disabled = value_hasPreInRange || value_hasTableInRange || value_hasQuoteInRange || extraDisabled("table");
24065
24075
  codeBlockConfig.value.active = !!getCurrentParsedomElement(editor.value, dataRangeCaches.value, "pre");
24066
- codeBlockConfig.value.disabled = value_hasTableInRange || value_hasQuoteInRange || extraDisabled("codeBlock");
24076
+ codeBlockConfig.value.disabled = value_hasTableInRange || value_hasQuoteInRange || value_hasImageInRange || value_hasVideoInRange || extraDisabled("codeBlock");
24067
24077
  sourceViewConfig.value.active = isSourceView.value;
24068
24078
  fullScreenConfig.value.active = isFullScreen.value;
24069
24079
  };
@@ -24758,7 +24768,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
24758
24768
  };
24759
24769
  }
24760
24770
  });
24761
- const Menu = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-b3e98aec"]]);
24771
+ const Menu = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-fbf50ae5"]]);
24762
24772
  const EditifyProps = {
24763
24773
  //国际化语言类型
24764
24774
  locale: {
@@ -26125,7 +26135,7 @@ const attachment = (options) => {
26125
26135
  menu: {
26126
26136
  sequence: options.sequence || 100,
26127
26137
  extraDisabled: (name) => {
26128
- if (name == "link" || name == "quote") {
26138
+ if (name == "link" || name == "quote" || name == "codeBlock") {
26129
26139
  return hasAttachmentInRange(editifyInstance.exposed.editor.value, editifyInstance.exposed.dataRangeCaches.value);
26130
26140
  }
26131
26141
  return false;
@@ -26232,7 +26242,7 @@ const attachment = (options) => {
26232
26242
  const install = (app) => {
26233
26243
  app.component(Editify.name, Editify);
26234
26244
  };
26235
- const version = "0.1.29";
26245
+ const version = "0.1.31";
26236
26246
  console.log(`%c vue-editify %c v${version} `, "padding: 2px 1px; border-radius: 3px 0 0 3px; color: #fff; background: #606060; font-weight: bold;", "padding: 2px 1px; border-radius: 0 3px 3px 0; color: #fff; background: #42c02e; font-weight: bold;");
26237
26247
  export {
26238
26248
  AlexElement,
@@ -26244,6 +26254,7 @@ export {
26244
26254
  getCurrentParsedomElement,
26245
26255
  getParsedomElementByElement,
26246
26256
  getRangeText,
26257
+ hasAttachmentInRange,
26247
26258
  hasImageInRange,
26248
26259
  hasLinkInRange,
26249
26260
  hasListInRange,
@@ -26258,6 +26269,7 @@ export {
26258
26269
  insertTable,
26259
26270
  insertVideo,
26260
26271
  install,
26272
+ isAttachment,
26261
26273
  isList,
26262
26274
  isRangeInList,
26263
26275
  isRangeInPre,