From b3f7bd94a122f73e6a5575d183fa925dd1d526ea Mon Sep 17 00:00:00 2001 From: ian Date: Thu, 17 Feb 2022 00:56:14 +0800 Subject: [PATCH] Remove access token from asset url when unnecessary (#10548) * Remove access token when unnecessary * Add missing translations * Refactor naming convention * Refactor naming convention * Refactor access token usage for media upload * Use static token for previews * Add missing imageToken for image upload * Rename imageToken to staticAccessToken * Remove temporary access token from embedUrl * Catch invalid URLs when replacing token * Fix embedUrl not updating when source changed * Patch audio and iframe uploads * Hide tinymce offscreen selection * Fix merge of interface fields * Use static tokens except for preview * Remove dirty checks through v-model for wysiwyg * Add missing translations * Fix lint warnings * Revert naming from staticAccessToken to imageToken --- .../input-rich-text-html/get-editor-styles.ts | 8 +- .../input-rich-text-html.vue | 75 ++++++------------- .../input-rich-text-html/useImage.ts | 40 +++++++--- .../input-rich-text-html/useLink.ts | 3 +- .../input-rich-text-html/useMedia.ts | 73 ++++++++++++------ .../input-rich-text-html/useSourceCode.ts | 3 +- .../input-rich-text-md/input-rich-text-md.vue | 19 +---- app/src/lang/translations/en-US.yaml | 10 ++- 8 files changed, 117 insertions(+), 114 deletions(-) diff --git a/app/src/interfaces/input-rich-text-html/get-editor-styles.ts b/app/src/interfaces/input-rich-text-html/get-editor-styles.ts index 7fb056a0b8..9cda29e6f9 100644 --- a/app/src/interfaces/input-rich-text-html/get-editor-styles.ts +++ b/app/src/interfaces/input-rich-text-html/get-editor-styles.ts @@ -39,6 +39,9 @@ body.mce-content-readonly { color: ${cssVar('--foreground-subdued')}; background-color: ${cssVar('--background-subdued')}; } +.mce-offscreen-selection { + display: none; +} h1, h2, h3, h4, h5, h6 { font-family: ${cssVar(`--family-${font}`)}, serif; color: ${cssVar('--foreground-normal-alt')}; @@ -135,12 +138,15 @@ blockquote { margin-left: 0px; } video, -iframe, img { max-width: 100%; border-radius: ${cssVar('--border-radius')}; height: auto; } +iframe { + max-width: 100%; + border-radius: ${cssVar('--border-radius')}; +} hr { background-color: ${cssVar('--border-normal')}; height: 1px; diff --git a/app/src/interfaces/input-rich-text-html/input-rich-text-html.vue b/app/src/interfaces/input-rich-text-html/input-rich-text-html.vue index 40a52a1a16..74acb24c9f 100644 --- a/app/src/interfaces/input-rich-text-html/input-rich-text-html.vue +++ b/app/src/interfaces/input-rich-text-html/input-rich-text-html.vue @@ -6,7 +6,6 @@ :init="editorOptions" :disabled="disabled" model-events="change keydown blur focus paste ExecCommand SetContent" - @dirty="setDirty" @focusin="setFocus(true)" @focusout="setFocus(false)" /> @@ -60,7 +59,7 @@ @@ -117,9 +116,14 @@