Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
chore(dx/client): fix SVG icons causing errors in CKEditor
Elian Doran5f1d2f02ee46
diff --git a/apps/client/src/widgets/type_widgets/editable_text.ts b/apps/client/src/widgets/type_widgets/editable_text.tsindex e1163e2b53..696e7900ed 100644--- a/apps/client/src/widgets/type_widgets/editable_text.ts+++ b/apps/client/src/widgets/type_widgets/editable_text.ts@@ -12,7 +12,6 @@ import { buildSelectedBackgroundColor } from "../../components/touch_bar.js";import { buildConfig, BuildEditorOptions, OPEN_SOURCE_LICENSE_KEY } from "./ckeditor/config.js";import type FNote from "../../entities/fnote.js";import { PopupEditor, ClassicEditor, EditorWatchdog, type CKTextEditor, type MentionFeed, type WatchdogConfig, EditorConfig } from "@triliumnext/ckeditor5";-import "@triliumnext/ckeditor5/index.css";import { updateTemplateCache } from "./ckeditor/snippets.js";const TPL = /*html*/`diff --git a/packages/ckeditor5-admonition/src/admonitionui.ts b/packages/ckeditor5-admonition/src/admonitionui.tsindex 09c78f8802..ec765ecced 100644--- a/packages/ckeditor5-admonition/src/admonitionui.ts+++ b/packages/ckeditor5-admonition/src/admonitionui.ts@@ -10,7 +10,7 @@import { Plugin, addListToDropdown, createDropdown, ListDropdownItemDefinition, SplitButtonView, ViewModel } from 'ckeditor5';import '../theme/blockquote.css';-import admonitionIcon from '../theme/icons/admonition.svg';+import admonitionIcon from '../theme/icons/admonition.svg?raw';import { AdmonitionType } from './admonitioncommand.js';import { Collection } from 'ckeditor5';diff --git a/packages/ckeditor5-admonition/src/index.ts b/packages/ckeditor5-admonition/src/index.tsindex 99edeece88..23716647d3 100644--- a/packages/ckeditor5-admonition/src/index.ts+++ b/packages/ckeditor5-admonition/src/index.ts@@ -1,4 +1,4 @@-import admonitionIcon from '../theme/icons/admonition.svg';+import admonitionIcon from '../theme/icons/admonition.svg?raw';import './augmentation.js';import "../theme/blockquote.css";diff --git a/packages/ckeditor5-admonition/typings/types.d.ts b/packages/ckeditor5-admonition/typings/types.d.tsindex 4333ece783..09be57e1c9 100644--- a/packages/ckeditor5-admonition/typings/types.d.ts+++ b/packages/ckeditor5-admonition/typings/types.d.ts@@ -1,4 +1,4 @@-declare module '*.svg' {+declare module '*.svg?raw' {const content: string;export default content;}diff --git a/packages/ckeditor5-footnotes/src/footnote-ui.ts b/packages/ckeditor5-footnotes/src/footnote-ui.tsindex c54b771879..719eb69013 100644--- a/packages/ckeditor5-footnotes/src/footnote-ui.ts+++ b/packages/ckeditor5-footnotes/src/footnote-ui.ts@@ -6,7 +6,7 @@ import {ELEMENTS,TOOLBAR_COMPONENT_NAME} from './constants.js';-import insertFootnoteIcon from '../theme/icons/insert-footnote.svg';+import insertFootnoteIcon from '../theme/icons/insert-footnote.svg?raw';import { modelQueryElement, modelQueryElementsAll } from './utils.js';export default class FootnoteUI extends Plugin {diff --git a/packages/ckeditor5-footnotes/src/index.ts b/packages/ckeditor5-footnotes/src/index.tsindex 66f96f2b6f..b93f1d62cd 100644--- a/packages/ckeditor5-footnotes/src/index.ts+++ b/packages/ckeditor5-footnotes/src/index.ts@@ -1,4 +1,4 @@-import insertFootnoteIcon from './../theme/icons/insert-footnote.svg';+import insertFootnoteIcon from './../theme/icons/insert-footnote.svg?raw';import './augmentation.js';import "../theme/footnote.css";diff --git a/packages/ckeditor5-footnotes/typings/types.d.ts b/packages/ckeditor5-footnotes/typings/types.d.tsindex 4333ece783..09be57e1c9 100644--- a/packages/ckeditor5-footnotes/typings/types.d.ts+++ b/packages/ckeditor5-footnotes/typings/types.d.ts@@ -1,4 +1,4 @@-declare module '*.svg' {+declare module '*.svg?raw' {const content: string;export default content;}diff --git a/packages/ckeditor5-keyboard-marker/src/index.ts b/packages/ckeditor5-keyboard-marker/src/index.tsindex eecb33f8d3..8b4dfd21fa 100644--- a/packages/ckeditor5-keyboard-marker/src/index.ts+++ b/packages/ckeditor5-keyboard-marker/src/index.ts@@ -1,4 +1,4 @@-import kbdIcon from '../theme/icons/kbd.svg';+import kbdIcon from '../theme/icons/kbd.svg?raw';import './augmentation.js';export { default as Kbd } from './kbd.js';diff --git a/packages/ckeditor5-keyboard-marker/src/kbdui.ts b/packages/ckeditor5-keyboard-marker/src/kbdui.tsindex 828157d665..0d12a7d28e 100644--- a/packages/ckeditor5-keyboard-marker/src/kbdui.ts+++ b/packages/ckeditor5-keyboard-marker/src/kbdui.ts@@ -1,5 +1,5 @@import { AttributeCommand, ButtonView, Plugin } from 'ckeditor5';-import kbdIcon from '../theme/icons/kbd.svg';+import kbdIcon from '../theme/icons/kbd.svg?raw';const KBD = 'kbd';diff --git a/packages/ckeditor5-keyboard-marker/typings/types.d.ts b/packages/ckeditor5-keyboard-marker/typings/types.d.tsindex 4333ece783..09be57e1c9 100644--- a/packages/ckeditor5-keyboard-marker/typings/types.d.ts+++ b/packages/ckeditor5-keyboard-marker/typings/types.d.ts@@ -1,4 +1,4 @@-declare module '*.svg' {+declare module '*.svg?raw' {const content: string;export default content;}diff --git a/packages/ckeditor5-math/src/index.ts b/packages/ckeditor5-math/src/index.tsindex f33a906208..6d6982ae23 100644--- a/packages/ckeditor5-math/src/index.ts+++ b/packages/ckeditor5-math/src/index.ts@@ -1,4 +1,4 @@-import ckeditor from './../theme/icons/math.svg';+import ckeditor from './../theme/icons/math.svg?raw';import './augmentation.js';import "../theme/mathform.css";diff --git a/packages/ckeditor5-math/src/mathui.ts b/packages/ckeditor5-math/src/mathui.tsindex a4efff4738..4c4a2794c5 100644--- a/packages/ckeditor5-math/src/mathui.ts+++ b/packages/ckeditor5-math/src/mathui.ts@@ -1,6 +1,6 @@import MathEditing from './mathediting.js';import MainFormView from './ui/mainformview.js';-import mathIcon from '../theme/icons/math.svg';+import mathIcon from '../theme/icons/math.svg?raw';import { Plugin, ClickObserver, ButtonView, ContextualBalloon, clickOutsideHandler, CKEditorError, uid } from 'ckeditor5';import { getBalloonPositionData } from './utils.js';import MathCommand from './mathcommand.js';@@ -54,10 +54,10 @@ export default class MathUI extends Plugin {this._addFormView();this._balloon.showStack( 'main' );-+requestAnimationFrame(() => {this.formView?.mathInputView.fieldView.element?.focus();- });+ });}private _createFormView() {diff --git a/packages/ckeditor5-math/typings/types.d.ts b/packages/ckeditor5-math/typings/types.d.tsindex 4333ece783..09be57e1c9 100644--- a/packages/ckeditor5-math/typings/types.d.ts+++ b/packages/ckeditor5-math/typings/types.d.ts@@ -1,4 +1,4 @@-declare module '*.svg' {+declare module '*.svg?raw' {const content: string;export default content;}diff --git a/packages/ckeditor5-mermaid/src/index.ts b/packages/ckeditor5-mermaid/src/index.tsindex 58fa30892e..d4f750bc8c 100644--- a/packages/ckeditor5-mermaid/src/index.ts+++ b/packages/ckeditor5-mermaid/src/index.ts@@ -1,11 +1,11 @@import './augmentation.js';export { default as Mermaid } from './mermaid.js';-import infoIcon from './../theme/icons/info.svg';-import insertMermaidIcon from './../theme/icons/insert.svg';-import previewModeIcon from './../theme/icons/preview-mode.svg';-import splitModeIcon from './../theme/icons/split-mode.svg';-import sourceModeIcon from './../theme/icons/source-mode.svg';+import infoIcon from './../theme/icons/info.svg?raw';+import insertMermaidIcon from './../theme/icons/insert.svg?raw';+import previewModeIcon from './../theme/icons/preview-mode.svg?raw';+import splitModeIcon from './../theme/icons/split-mode.svg?raw';+import sourceModeIcon from './../theme/icons/source-mode.svg?raw';import "../theme/mermaid.css";export const icons = {diff --git a/packages/ckeditor5-mermaid/src/mermaidui.ts b/packages/ckeditor5-mermaid/src/mermaidui.tsindex d5fc6519eb..0edc9c8337 100644--- a/packages/ckeditor5-mermaid/src/mermaidui.ts+++ b/packages/ckeditor5-mermaid/src/mermaidui.ts@@ -2,11 +2,11 @@* @module mermaid/mermaidui*/-import insertMermaidIcon from '../theme/icons/insert.svg';-import previewModeIcon from '../theme/icons/preview-mode.svg';-import splitModeIcon from '../theme/icons/split-mode.svg';-import sourceModeIcon from '../theme/icons/source-mode.svg';-import infoIcon from '../theme/icons/info.svg';+import insertMermaidIcon from '../theme/icons/insert.svg?raw';+import previewModeIcon from '../theme/icons/preview-mode.svg?raw';+import splitModeIcon from '../theme/icons/split-mode.svg?raw';+import sourceModeIcon from '../theme/icons/source-mode.svg?raw';+import infoIcon from '../theme/icons/info.svg?raw';import { ButtonView, Editor, ModelElement, Locale, Observable, Plugin } from 'ckeditor5';import InsertMermaidCommand from './commands/insertMermaidCommand.js';diff --git a/packages/ckeditor5-mermaid/tests/index.ts b/packages/ckeditor5-mermaid/tests/index.tsindex 06f8e2d83a..a2ec5fd563 100644--- a/packages/ckeditor5-mermaid/tests/index.ts+++ b/packages/ckeditor5-mermaid/tests/index.ts@@ -1,11 +1,11 @@import { Mermaid as MermaidDll, icons } from '../src/index.js';import Mermaid from '../src/mermaid.js';-import infoIcon from './../theme/icons/info.svg';-import insertMermaidIcon from './../theme/icons/insert.svg';-import previewModeIcon from './../theme/icons/preview-mode.svg';-import splitModeIcon from './../theme/icons/split-mode.svg';-import sourceModeIcon from './../theme/icons/source-mode.svg';+import infoIcon from './../theme/icons/info.svg?raw';+import insertMermaidIcon from './../theme/icons/insert.svg?raw';+import previewModeIcon from './../theme/icons/preview-mode.svg?raw';+import splitModeIcon from './../theme/icons/split-mode.svg?raw';+import sourceModeIcon from './../theme/icons/source-mode.svg?raw';import { describe, it } from 'vitest';import { expect } from 'vitest';diff --git a/packages/ckeditor5-mermaid/typings/types.d.ts b/packages/ckeditor5-mermaid/typings/types.d.tsindex 4333ece783..09be57e1c9 100644--- a/packages/ckeditor5-mermaid/typings/types.d.ts+++ b/packages/ckeditor5-mermaid/typings/types.d.ts@@ -1,4 +1,4 @@-declare module '*.svg' {+declare module '*.svg?raw' {const content: string;export default content;}diff --git a/packages/ckeditor5/src/plugins/file_upload/progressbarview.ts b/packages/ckeditor5/src/plugins/file_upload/progressbarview.tsindex daa888751e..24d5a1a356 100644--- a/packages/ckeditor5/src/plugins/file_upload/progressbarview.ts+++ b/packages/ckeditor5/src/plugins/file_upload/progressbarview.ts@@ -1,4 +1,4 @@-import cancelIcon from '@ckeditor/ckeditor5-core/theme/icons/cancel.svg';+import cancelIcon from '@ckeditor/ckeditor5-core/theme/icons/cancel.svg?raw';import { ButtonView, Locale, toUnit, View } from 'ckeditor5';const toPx = toUnit('%');