vuux
Version:
Vue3 Nuxt3 Nuxt4 组件库
32 lines (31 loc) • 1.06 kB
JavaScript
import { defineComponent as c, useTemplateRef as m, createBlock as p, openBlock as u, resolveDynamicComponent as f, unref as t, normalizeClass as b, withCtx as x, createTextVNode as _, toDisplayString as y } from "vue";
import { useEditorText as C } from "../hook/useEditorText.mjs";
const T = /* @__PURE__ */ c({
name: "EditorText",
__name: "index",
props: {
modelValue: {},
disabled: { type: Boolean },
is: { default: "div" }
},
emits: ["update:modelValue", "finish"],
setup(o, { emit: i }) {
const e = o, a = i, n = m("editableEl"), { innerValue: l, editing: d, enableEdit: s, handleKeydown: r } = C(e, n, a);
return (E, k) => (u(), p(f(e.is), {
ref_key: "editableEl",
ref: n,
class: b(["app-editor-text", { "is-disabled": e.disabled }]),
contenteditable: !e.disabled && t(d),
onClick: t(s),
onKeydown: t(r)
}, {
default: x(() => [
_(y(t(l)), 1)
]),
_: 1
}, 40, ["class", "contenteditable", "onClick", "onKeydown"]));
}
});
export {
T as default
};