[Edit Content]: System-wide TinyMCE config (get.vtl) is intermittently ignored because the editor initialises before /api/vtl/tinymceprops returns

オープン
#38,514 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
74/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
angular, typescript
領域
frontend

調査の方向性

Start with dot-wysiwyg-tinymce.component.ts and its HTML template, then read dot-wysiwyg-tinymce.component.spec.ts to see how the config request and editor initialization are wired. Reproduce the race with a delayed getProps() response and verify the editor receives the system-wide options after it resolves. Done means the editor waits for the response or failure, retains the documented merge order and fallback defaults, and the delayed-response test passes.

索引モデルが issue の本文から書いたものです。

説明

OKR : Customer Support
Problem Statement

The new Edit Content screen loads the system-wide WYSIWYG config from /api/vtl/tinymceprops, which serves /application/apivtl/tinymceprops/get.vtl. The editor doesn't wait for that response, so whether the config is applied depends on network timing. Usually it isn't, and the field falls back to dotCMS's default TinyMCE config with no error.

dot-wysiwyg-tinymce.component.ts loads the config asynchronously:

$wideConfig = toSignal<RawEditorOptions>(this.#dotWysiwygTinymceService.getProps());

and the template passes the merged config straight to the editor:

<editor [formControlName]="field.variable" [init]="$editorConfig()" ... />

@tinymce/tinymce-angular reads init once, when it calls tinymce.init(). If $wideConfig() is still undefined at that moment, the system-wide config is never used. A later update to $editorConfig() doesn't re-initialise the editor.

The tinymceprops field variable isn't affected, because it's read synchronously from the field definition.

How often: measured on a customer database restored locally.

  • In-app navigation (Content Search → open a contentlet): 3 out of 3 opens got the defaults. TinyMCE is already loaded, so tinymce.init() runs before the request can come back.
  • Full page load: 2 out of 2 got the defaults. tinymce.min.js finished at about 860 ms and /api/vtl/tinymceprops 9–14 ms later.
  • First load in a fresh session: the config was applied once. It's a race, not a consistent failure.

Who it affects: any customer that relies on get.vtl for site-wide editor settings, such as plugins, toolbars, content CSS or cleanup rules. That's the documented way to configure the WYSIWYG field system-wide. Their editors get dotCMS's default toolbar and plugins, so custom plugins, formats and validation rules go missing and content can be saved without the customer's cleanup rules applied. Because there's no error, it looks like intermittent misbehaviour rather than missing config.

Why the tests don't catch it: dot-wysiwyg-tinymce.component.spec.ts mocks getProps() with a synchronous of(...), so $wideConfig() already has its value when the editor initialises.

Browser/OS: Chrome on macOS. The race doesn't depend on the browser.

Steps to Reproduce
  1. Create /application/apivtl/tinymceprops/get.vtl on the default site, saved by an admin or Scripting Developer, containing:
    #[[
    { "plugins": "lists link table", "toolbar1": "bold italic | bullist | link | table", "menubar": true, "content_css": "/some/marker.css" }
    ]]#
    
  2. Confirm GET /api/vtl/tinymceprops returns that JSON.
  3. Turn on the new editor for a content type with a WYSIWYG field and no tinymceprops field variable.
  4. Go to Content → Search and open a contentlet of that type.
  5. In the browser console, run tinymce.activeEditor.options.get('toolbar1') and Object.keys(tinymce.activeEditor.plugins).

Expected: the toolbar and plugins from get.vtl, and a request for /some/marker.css.

Actual: dotCMS's default toolbar (undo redo | bold italic | alignleft ... dotAddImage hr) and default plugin list, and no request for marker.css. The Network tab shows /api/vtl/tinymceprops returning 200 with the right JSON after tinymce.min.js had already loaded.

To check the timing:

const e = performance.getEntriesByType('resource');
const t = n => Math.round(e.find(r => r.name.includes(n)).responseEnd);
({ props: t('/api/vtl/tinymceprops'), tinymce: t('tinymce.min.js') });
Acceptance Criteria
  • The WYSIWYG field doesn't render <editor> until /api/vtl/tinymceprops has either returned or failed. For example, wrap it in @if on a "loaded" state that's undefined while pending and null on error.
  • If the request fails (404 when there's no get.vtl, 403 when its last editor can't script, or 5xx), the editor still renders with the defaults plus the field variable, as it does today.
  • The system-wide config is applied every time: on first page load, on full reload, and when opening contentlets through in-app navigation.
  • Merge order is unchanged: DEFAULT_TINYMCE_CONFIG, then the system-wide config, then the tinymceprops field variable, then the forced iframe_* attributes and setup.
  • The request is made at most once per page or session, not once per WYSIWYG field.
  • A unit test makes getProps() resolve after the editor would otherwise initialise (for example a Subject emitted after detectChanges()) and asserts that the editor gets the system-wide options. The current of(...) mock can't reproduce the race.
  • The field doesn't flicker or shift layout visibly while the config loads.
dotCMS Version
  • Reproduced on dotcms/dotcms:trunk, pulled 2026-11-10, with TinyMCE 6.8.4.
  • The async toSignal(getProps()) pattern was added in #30131 (2024-09-25, first in v24.10.02), so every version since then is likely affected. The customer is on 26.08.x.
Severity

High - Major functionality broken

The documented system-wide configuration for the new editor works only by chance. There's a workaround: copy the config JSON into every WYSIWYG field's tinymceprops field variable. It's tedious, and it breaks the legacy editor if done before a content type moves to the new editor.

Links
  • Freshdesk: https://dotcms.freshdesk.com/a/tickets/37917
  • Related: #36199 (tinymceprops field variable no longer supports VTL in the new editor)
  • Slack: #feat-edit-content
  • Code: core-web/libs/edit-content/src/lib/fields/dot-edit-content-wysiwyg-field/components/dot-wysiwyg-tinymce/dot-wysiwyg-tinymce.component.ts ($wideConfig, $editorConfig) and its .html template
主要言語
Java
スター
972
フォーク
493
平均マージ
2日 12時間
マージ済み PR(30日)
228

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

dotCMS/core のほかの issue

dotCMS/core の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。