From 09dd610a1efead40970d1c4f7fc167514aeb3aa4 Mon Sep 17 00:00:00 2001 From: fangxiang Date: Fri, 5 Nov 2021 09:15:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=BB=9A=E5=8A=A8=E6=9D=A1?= =?UTF-8?q?=E5=A4=B1=E6=95=88=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/SignalSourceTree.vue | 4 +- src/components/SubtitleDialog.vue | 114 ++++++++++++++++++---------- src/i18n/zh-CN/index.ts | 2 + 3 files changed, 80 insertions(+), 40 deletions(-) diff --git a/src/components/SignalSourceTree.vue b/src/components/SignalSourceTree.vue index 15ea1e7..f2b181f 100644 --- a/src/components/SignalSourceTree.vue +++ b/src/components/SignalSourceTree.vue @@ -1,5 +1,5 @@ diff --git a/src/components/SubtitleDialog.vue b/src/components/SubtitleDialog.vue index 36a23f8..30c569d 100644 --- a/src/components/SubtitleDialog.vue +++ b/src/components/SubtitleDialog.vue @@ -5,7 +5,7 @@ @show="onShow" @before-hide="resetData" > - +
@@ -14,6 +14,23 @@
+ + + {{ + $q.fullscreen.isActive + ? $t("Exit Fullscreen") + : $t("Go Fullscreen") + }} + + - + @@ -112,19 +129,19 @@ - +
-
+
@@ -170,7 +187,6 @@ main .ck-editor[role='application'] .ck.ck-content, width: 100%; background: #fff; font-size: 1em; - line-height: 1.6em; min-height: var(--ck-sample-editor-min-height); padding: 1.5em 2em; } @@ -210,12 +226,14 @@ import { computed, onMounted, onBeforeUnmount, + nextTick, } from "vue"; import { useStore } from "src/store"; import { useQuasar } from "quasar"; import { useI18n } from "vue-i18n"; import GlobalData from "src/common/GlobalData"; import SubtitleEntity from "src/entities/SubtitleEntity"; +import { log } from "util"; export default defineComponent({ name: "ComponentSubtitleDialog", @@ -229,6 +247,7 @@ export default defineComponent({ let subtitle = ref(new SubtitleEntity()); let wysiwyg_editor: Ref = ref(null); let wysiwyg_toolbar: Ref = ref(null); + let editor_parent: Ref = ref(null); let editor: any = null; const createEditor = () => { @@ -237,35 +256,38 @@ export default defineComponent({ return; } + const fontOptions: number[] = [9, 11, 13, 17]; + for (let i = 17 + 2; i < 100; i += 2) { + fontOptions.push(i); + } + + for (let i = 103; i < 150; i += 3) { + fontOptions.push(i); + } + + for (let i = 154; i < 180; i += 4) { + fontOptions.push(i); + } + + for (let i = 185; i < 200; i += 5) { + fontOptions.push(i); + } + + for (let i = 210; i < 250; i += 10) { + fontOptions.push(i); + } + + for (let i = 270; i < 300; i += 20) { + fontOptions.push(i); + } + + for (let i = 330; i < 360; i += 30) { + fontOptions.push(i); + } + (window as any).DecoupledDocumentEditor.create(wysiwyg_editor.value, { fontSize: { - options: [ - 9, - 11, - 13, - "default", - 17, - 19, - 21, - 25, - 29, - 31, - 35, - 39, - 41, - 45, - 49, - 51, - 55, - 59, - 61, - 69, - 71, - 79, - 89, - 99, - 109, - ], + options: fontOptions, }, toolbar: { items: [ @@ -284,8 +306,6 @@ export default defineComponent({ "bulletedList", "todoList", "|", - "blockQuote", - "|", "undo", "redo", ], @@ -315,6 +335,7 @@ export default defineComponent({ subtitle, wysiwyg_editor, wysiwyg_toolbar, + editor_parent, async showDialog() { show_dialog.value = true; loading.value = true; @@ -335,12 +356,18 @@ export default defineComponent({ }, onShow() { if (editor) { - editor.ui.view.toolbar.isCompact = false; - editor.ui.view.toolbar.maxWidth = "100%"; + setTimeout(() => { + editor.ui.view.toolbar.isCompact = false; + editor.ui.view.toolbar.maxWidth = "100%"; + }, 500); document.querySelectorAll(".ck-dropdown__panel").forEach((item) => { ((item as HTMLElement)?.style as any).overflow = "auto"; - ((item as HTMLElement)?.style as any).height = "45vh"; + ((item as HTMLElement)?.style as any).overflowX = "hidden"; + ((item as HTMLElement)?.style as any).height = "40vh"; + item.querySelectorAll(".ck-button__label").forEach((item_) => { + ((item_ as HTMLElement)?.style as any).fontSize = "20px"; + }); }); editor.setData(subtitle.value.text); @@ -397,6 +424,17 @@ export default defineComponent({ } catch {} loading.value = false; }, + toggleFullScreen(e: any) { + console.log(e); + const target = e.target.parentNode.parentNode.parentNode; + console.log(target); + $q.fullscreen + .toggle(target) + .then(() => {}) + .catch((err) => { + console.error(err); + }); + }, }; }, }); diff --git a/src/i18n/zh-CN/index.ts b/src/i18n/zh-CN/index.ts index 6570370..cc4637b 100644 --- a/src/i18n/zh-CN/index.ts +++ b/src/i18n/zh-CN/index.ts @@ -170,4 +170,6 @@ export default { "set subtitle success": "设置字幕成功", "input data error": "输入数据错误", "editor error": "富文本编辑器内部错误", + "Exit Fullscreen": "退出全屏", + "Go Fullscreen": "全屏", };