chore(dx/client): fix SVG icons causing errors in CKEditor

This commit is contained in:
Elian Doran 2025-08-31 19:26:47 +03:00
parent 46cb869237
commit 5f1d2f02ee
No known key found for this signature in database
18 changed files with 31 additions and 32 deletions

View File

@ -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*/`

View File

@ -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';

View File

@ -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";

View File

@ -1,4 +1,4 @@
declare module '*.svg' {
declare module '*.svg?raw' {
const content: string;
export default content;
}

View File

@ -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 {

View File

@ -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";

View File

@ -1,4 +1,4 @@
declare module '*.svg' {
declare module '*.svg?raw' {
const content: string;
export default content;
}

View File

@ -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';

View File

@ -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';

View File

@ -1,4 +1,4 @@
declare module '*.svg' {
declare module '*.svg?raw' {
const content: string;
export default content;
}

View File

@ -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";

View File

@ -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() {

View File

@ -1,4 +1,4 @@
declare module '*.svg' {
declare module '*.svg?raw' {
const content: string;
export default content;
}

View File

@ -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 = {

View File

@ -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';

View File

@ -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';

View File

@ -1,4 +1,4 @@
declare module '*.svg' {
declare module '*.svg?raw' {
const content: string;
export default content;
}

View File

@ -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('%');