yanzhen-design-vue
Version:
81 lines (80 loc) • 3.38 kB
JavaScript
"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const vue = require("vue");
const editorForVue = require("@wangeditor/editor-for-vue");
const antDesignVue = require("ant-design-vue");
const richTextProps = require("./rich-text-props.cjs");
const useRichText = require("./use-rich-text.cjs");
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
...{ name: richTextProps.richTextName },
__name: "rich-text",
props: richTextProps.richTextProps,
emits: richTextProps.richTextEmits,
setup(__props, { emit: __emit }) {
const { ns } = richTextProps.richTextOptions;
const props = __props;
const emits = __emit;
const {
_ref,
_toolbarRef,
_editorRef,
_props,
_modelValue,
notSupport,
config,
open,
handleCreated,
DefineRichText,
ReusableRichText
} = useRichText.useRichText(props, emits);
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
vue.createVNode(vue.unref(DefineRichText), null, {
default: vue.withCtx(() => [
vue.createElementVNode("div", vue.mergeProps({
class: [vue.unref(ns).b()]
}, vue.unref(_props)), [
props.showToolbar ? (vue.openBlock(), vue.createBlock(vue.unref(editorForVue.Toolbar), {
key: 0,
ref_key: "_toolbarRef",
ref: _toolbarRef,
class: vue.normalizeClass([vue.unref(ns).b("toolbar")]),
editor: vue.unref(_ref).editor,
"default-config": vue.unref(config).toolbar,
mode: vue.unref(config).mode
}, null, 8, ["class", "editor", "default-config", "mode"])) : vue.createCommentVNode("", true),
vue.createVNode(vue.unref(editorForVue.Editor), {
modelValue: vue.unref(_modelValue),
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(_modelValue) ? _modelValue.value = $event : null),
class: vue.normalizeClass([vue.unref(ns).b("editor")]),
mode: vue.unref(config).mode,
"default-config": vue.unref(config).editor,
onOnCreated: vue.unref(handleCreated)
}, null, 8, ["modelValue", "class", "mode", "default-config", "onOnCreated"])
], 16)
]),
_: 1
}),
vue.unref(notSupport) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
vue.createVNode(vue.unref(antDesignVue.Button), { type: "link" }, {
default: vue.withCtx(() => _cache[2] || (_cache[2] = [
vue.createTextVNode("不支持")
])),
_: 1
}),
vue.createVNode(vue.unref(antDesignVue.Modal), {
open: vue.unref(open),
"onUpdate:open": _cache[1] || (_cache[1] = ($event) => vue.isRef(open) ? open.value = $event : null),
width: "80vh"
}, {
default: vue.withCtx(() => [
vue.createVNode(vue.unref(ReusableRichText))
]),
_: 1
}, 8, ["open"])
], 64)) : (vue.openBlock(), vue.createBlock(vue.unref(ReusableRichText), { key: 1 }))
], 64);
};
}
});
exports.default = _sfc_main;