|
@@ -29,7 +29,7 @@ function GetConfig() {
|
|
|
fontSizeOptions.push({ title: s + "", model: s + "px" });
|
|
|
}
|
|
|
const fontFamilyOptions = [
|
|
|
- { title: "宋体", model: "宋体,Songti STSong,serif" },
|
|
|
+ { title: "宋体", model: "宋体,Songti,STSong,serif" },
|
|
|
{ title: "黑体", model: "黑体,Heiti,STHeiti,sans-serif" },
|
|
|
{ title: "仿宋", model: "仿宋,FangSong,STFangsong,serif" },
|
|
|
{ title: "楷体", model: "楷体,KaiTi,STKaiti,sans-serif" },
|
|
@@ -109,17 +109,12 @@ export const Component = defineComponent({
|
|
|
}
|
|
|
}}
|
|
|
>
|
|
|
- {state.editableId ? (
|
|
|
- <EditorComp
|
|
|
- compId={props.compId}
|
|
|
- key={state.editableId}
|
|
|
- onLost={() => {
|
|
|
- state.editableId = "";
|
|
|
- }}
|
|
|
- />
|
|
|
- ) : (
|
|
|
- <div innerHTML={comp.value} />
|
|
|
- )}
|
|
|
+ {
|
|
|
+ state.editableId ? <EditorComp compId={props.compId} key={state.editableId} onLost={()=>{
|
|
|
+ state.editableId = "";
|
|
|
+ }} />
|
|
|
+ : <div innerHTML={comp.value} class={readOnlyText} />
|
|
|
+ }
|
|
|
</View>
|
|
|
);
|
|
|
},
|
|
@@ -167,41 +162,51 @@ const EditorComp = defineComponent({
|
|
|
};
|
|
|
}
|
|
|
|
|
|
- return () => (
|
|
|
- <ckeditor
|
|
|
- class={textStyle}
|
|
|
- ref={inputRef}
|
|
|
- editor={InlineEditor}
|
|
|
- onInput={(value: any) => {
|
|
|
- if (editorInstance.value && comp.value !== value) {
|
|
|
- actions.updateCompData(comp, "value", value);
|
|
|
- nextTick(() => {
|
|
|
- actions.updateCompDatas(
|
|
|
- comp,
|
|
|
- ["value", "layout.size.1"],
|
|
|
- [value, helper.pxToDesignSize(inputRef.value?.$el.clientHeight)]
|
|
|
- );
|
|
|
- controls.selectCtrl.upgateGizmoStyle();
|
|
|
- helper.extendStreamCard(store.currStreamCardId);
|
|
|
- });
|
|
|
- }
|
|
|
- }}
|
|
|
- onReady={(editor: InlineEditor) => {
|
|
|
- editorInstance.value = editor;
|
|
|
- console.log("editor");
|
|
|
- editor.setData(comp.value);
|
|
|
- editor.focus();
|
|
|
- const range = document.createRange();
|
|
|
- range.selectNodeContents(inputRef.value.$el);
|
|
|
- const selection = window.getSelection();
|
|
|
- selection?.removeAllRanges();
|
|
|
- selection?.addRange(range);
|
|
|
- }}
|
|
|
- config={GetConfig()}
|
|
|
- />
|
|
|
- );
|
|
|
+ const preHeight = ref<number>(0);
|
|
|
+
|
|
|
+ return ()=><ckeditor
|
|
|
+ class={textStyle}
|
|
|
+ ref={inputRef}
|
|
|
+ editor={InlineEditor}
|
|
|
+ onInput={(value: any) => {
|
|
|
+ if (editorInstance.value && comp.value !== value) {
|
|
|
+ actions.updateCompData(comp, "value", value);
|
|
|
+ nextTick(()=>{
|
|
|
+
|
|
|
+ const h = helper.pxToDesignSize(inputRef.value?.$el.clientHeight);
|
|
|
+ const isChange = Math.abs(preHeight.value - h) > 1;
|
|
|
+ preHeight.value = h;
|
|
|
+ actions.updateCompDatas(comp, ["value", "layout.size.1"], [value, preHeight.value])
|
|
|
+ helper.extendStreamCard(store.currStreamCardId);
|
|
|
+ if (isChange) {
|
|
|
+ console.log("changing=>", isChange);
|
|
|
+ actions.selectObjs([]);
|
|
|
+ setTimeout(() => {
|
|
|
+ actions.selectObjs([props.compId]);
|
|
|
+ }, 0);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }}
|
|
|
+ onReady={(editor: InlineEditor) => {
|
|
|
+ editorInstance.value = editor;
|
|
|
+ console.log("editor")
|
|
|
+ editor.setData(comp.value);
|
|
|
+ editor.focus();
|
|
|
+ const range = document.createRange();
|
|
|
+ range.selectNodeContents(inputRef.value.$el);
|
|
|
+ const selection = window.getSelection();
|
|
|
+ selection?.removeAllRanges();
|
|
|
+ selection?.addRange(range);
|
|
|
+ }}
|
|
|
+ config={GetConfig()}
|
|
|
+ />
|
|
|
},
|
|
|
-});
|
|
|
+})
|
|
|
+
|
|
|
+const readOnlyText = css`
|
|
|
+ pointer-events: none;
|
|
|
+`
|
|
|
|
|
|
const textStyle = css`
|
|
|
font-size: 0.24rem;
|