yanzhen-design-vue
Version:
114 lines (113 loc) • 5.47 kB
JavaScript
import { defineComponent, ref, openBlock, createBlock, unref, createSlots, withCtx, createVNode, normalizeClass, createElementVNode, mergeProps, withModifiers, toDisplayString, createCommentVNode } from "vue";
import { Tooltip, Button, Modal } from "ant-design-vue";
import "../../text-preview/index.mjs";
import "./rich-text.vue.mjs";
import { richTextPreviewName, richTextPreviewProps, richTextPreviewEmits, richTextOptions } from "./rich-text-props.mjs";
import { useTextPreview } from "../../text-preview/src/use-text-preview.mjs";
import _sfc_main$1 from "./rich-text.vue2.mjs";
const _sfc_main = /* @__PURE__ */ defineComponent({
...{ name: richTextPreviewName, inheritAttrs: true },
__name: "rich-text-preview",
props: richTextPreviewProps,
emits: richTextPreviewEmits,
setup(__props, { emit: __emit }) {
const { ns } = richTextOptions;
const props = __props;
const emit = __emit;
const { previewTextRef } = useTextPreview(props, emit);
const open = ref(false);
const tooltipOpen = ref(false);
function handleClick() {
tooltipOpen.value = false;
open.value = true;
}
return (_ctx, _cache) => {
return props.value ? (openBlock(), createBlock(unref(Tooltip), {
key: 0,
open: tooltipOpen.value,
"onUpdate:open": _cache[1] || (_cache[1] = ($event) => tooltipOpen.value = $event),
"overlay-class-name": unref(ns).b("preview-tooltip")
}, createSlots({
default: withCtx(() => [
createVNode(unref(Button), {
type: "link",
class: normalizeClass([unref(ns).b("preview")]),
onClick: handleClick
}, {
default: withCtx(() => _cache[2] || (_cache[2] = [
createElementVNode("svg", {
width: "20px",
height: "20px",
viewBox: "0 0 20 20"
}, [
createElementVNode("g", {
id: "页面-1",
stroke: "none",
"stroke-width": "1",
fill: "none",
"fill-rule": "evenodd"
}, [
createElementVNode("g", {
id: "图标汇总",
transform: "translate(-35.000000, -415.000000)",
"fill-rule": "nonzero"
}, [
createElementVNode("g", {
id: "富文本备份-2",
transform: "translate(35.000000, 415.000000)"
}, [
createElementVNode("rect", {
id: "矩形",
fill: "#000000",
opacity: "0",
x: "0",
y: "0",
width: "20",
height: "20"
}),
createElementVNode("path", {
id: "形状",
d: "M13.9090909,6.18181818 L6.27272727,6.18181818 C5.9090909,6.18181818 5.54545455,6.45454545 5.54545455,6.90909092 C5.54545455,7.36363639 5.90909092,7.63636365 6.27272727,7.63636363 L9.36363637,7.63636363 L9.36363637,14.3636364 C9.36363637,14.7272727 9.72727273,15.0909091 10.0909091,15.0909091 C10.4545454,15.0909091 10.8181818,14.7272727 10.8181818,14.3636364 L10.8181818,7.63636363 L13.9090909,7.63636363 C14.2727273,7.63636363 14.6363636,7.27272727 14.6363636,6.90909092 C14.6363636,6.54545457 14.2727273,6.18181818 13.9090909,6.18181818 Z M16.4545454,1 L3.45454545,1 C2.09090908,1 0.909090918,2.18181818 0.909090918,3.54545455 L0.909090918,16.5454546 C0.909090918,17.9090909 2.0909091,19.0909091 3.45454545,19.0909091 L16.4545454,19.0909091 C17.9090909,19.0909091 19,18 19,16.5454546 L19,3.45454545 C19,2.09090908 17.9090909,1 16.4545454,1 Z M17.6363636,16.5454546 C17.6363636,17.1818182 17.1818182,17.6363636 16.5454546,17.6363636 L3.54545455,17.6363636 C2.90909092,17.6363636 2.45454545,17.1818182 2.45454545,16.5454546 L2.45454545,3.45454545 C2.45454545,2.81818182 2.9090909,2.36363637 3.54545455,2.36363637 L16.5454546,2.36363637 C17.1818182,2.36363637 17.6363636,2.81818182 17.6363636,3.45454545 L17.6363636,16.5454546 Z",
fill: "#979797"
})
])
])
])
], -1)
])),
_: 1
}, 8, ["class"]),
createVNode(unref(Modal), {
open: open.value,
"onUpdate:open": _cache[0] || (_cache[0] = ($event) => open.value = $event),
width: "80vh",
footer: null
}, {
default: withCtx(() => [
createVNode(_sfc_main$1, mergeProps({ style: { "height": "70vh" } }, props, {
disabled: "",
"show-toolbar": false
}), null, 16)
]),
_: 1
}, 8, ["open"])
]),
_: 2
}, [
unref(previewTextRef) ? {
name: "title",
fn: withCtx(() => [
createElementVNode("div", {
class: normalizeClass(unref(ns).b("preview-tooltip-title")),
onClick: withModifiers(handleClick, ["stop"])
}, toDisplayString(unref(previewTextRef)), 3)
]),
key: "0"
} : void 0
]), 1032, ["open", "overlay-class-name"])) : createCommentVNode("", true);
};
}
});
export {
_sfc_main as default
};