vue-editify 0.1.30 → 0.1.32

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">
@@ -190,7 +190,7 @@ export type PluginResultType = {
190
190
  pasteKeepStyles?: ObjectType;
191
191
  pasteKeepMarks?: ObjectType;
192
192
  };
193
- export type PluginType = (editifyInstance: ComponentInternalInstance, color: string | null, editTrans: (key: string) => any) => PluginResultType;
193
+ export type PluginType = (editifyInstance: ComponentInternalInstance, editTrans: (key: string) => any) => PluginResultType;
194
194
  /**
195
195
  * 粘贴html时保留的数据
196
196
  */
package/lib/editify.es.js CHANGED
@@ -25184,7 +25184,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
25184
25184
  const pluginResultList = computed(() => {
25185
25185
  const pluginResultList2 = [];
25186
25186
  props.plugins.forEach((plugin) => {
25187
- let pluginResult = plugin(instance, props.color, $editTrans);
25187
+ let pluginResult = plugin(instance, $editTrans);
25188
25188
  pluginResultList2.push(pluginResult);
25189
25189
  });
25190
25190
  return pluginResultList2;
@@ -25858,7 +25858,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
25858
25858
  };
25859
25859
  }
25860
25860
  });
25861
- const Editify = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-306d3e9a"]]);
25861
+ const Editify = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-4a3bc815"]]);
25862
25862
  const InsertAttachmentProps = {
25863
25863
  //主题色
25864
25864
  color: {
@@ -26124,7 +26124,7 @@ const attachment = (options) => {
26124
26124
  if (!common.isObject(options)) {
26125
26125
  options = {};
26126
26126
  }
26127
- const plugin = (editifyInstance, color2, editTrans) => {
26127
+ const plugin = (editifyInstance, editTrans) => {
26128
26128
  let isDisabled = false;
26129
26129
  if (editifyInstance.exposed.editor.value) {
26130
26130
  isDisabled = hasPreInRange(editifyInstance.exposed.editor.value, editifyInstance.exposed.dataRangeCaches.value) || hasLinkInRange(editifyInstance.exposed.editor.value, editifyInstance.exposed.dataRangeCaches.value) || hasQuoteInRange(editifyInstance.exposed.editor.value, editifyInstance.exposed.dataRangeCaches.value);
@@ -26149,7 +26149,7 @@ const attachment = (options) => {
26149
26149
  disabled: isDisabled,
26150
26150
  default: () => h(Icon, { value: "attachment" }),
26151
26151
  layer: (_name, btnInstance) => h(InsertAttachment, {
26152
- color: color2,
26152
+ color: editifyInstance.props.color,
26153
26153
  accept: options.accept,
26154
26154
  allowedFileType: options.allowedFileType || [],
26155
26155
  multiple: !!options.multiple,
@@ -26242,7 +26242,7 @@ const attachment = (options) => {
26242
26242
  const install = (app) => {
26243
26243
  app.component(Editify.name, Editify);
26244
26244
  };
26245
- const version = "0.1.30";
26245
+ const version = "0.1.32";
26246
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;");
26247
26247
  export {
26248
26248
  AlexElement,
@@ -26254,6 +26254,7 @@ export {
26254
26254
  getCurrentParsedomElement,
26255
26255
  getParsedomElementByElement,
26256
26256
  getRangeText,
26257
+ hasAttachmentInRange,
26257
26258
  hasImageInRange,
26258
26259
  hasLinkInRange,
26259
26260
  hasListInRange,
@@ -26268,6 +26269,7 @@ export {
26268
26269
  insertTable,
26269
26270
  insertVideo,
26270
26271
  install,
26272
+ isAttachment,
26271
26273
  isList,
26272
26274
  isRangeInList,
26273
26275
  isRangeInPre,