Unverified Commit d672dfa5 authored by Lauri Timmanee's avatar Lauri Timmanee
Browse files

Issue #3228778 by nod_, Wim Leers: Drupal-specific CKEditor 5 plugins should...

Issue #3228778 by nod_, Wim Leers: Drupal-specific CKEditor 5 plugins should be able to use Drupal's JS translation API: Drupal.t()

(cherry picked from commit 6ec31487)
parent 4711b764
Loading
Loading
Loading
Loading
+1 −1

File changed.

Preview size limit exceeded, changes collapsed.

+1 −2
Original line number Diff line number Diff line
@@ -60,7 +60,6 @@ export default class DrupalLinkMediaUI extends Plugin {
   */
  _createToolbarLinkMediaButton() {
    const { editor } = this;
    const { t } = editor;

    editor.ui.componentFactory.add('drupalLinkMedia', (locale) => {
      const button = new ButtonView(locale);
@@ -69,7 +68,7 @@ export default class DrupalLinkMediaUI extends Plugin {

      button.set({
        isEnabled: true,
        label: t('Link media'),
        label: Drupal.t('Link media'),
        icon: linkIcon,
        keystroke: LINK_KEYSTROKE,
        tooltip: true,
+2 −2
Original line number Diff line number Diff line
@@ -29,11 +29,11 @@ export default class DrupalMediaEditing extends Plugin {
    }
    const { previewURL, themeError } = options;
    this.previewURL = previewURL;
    this.labelError = this.editor.t('Preview failed');
    this.labelError = Drupal.t('Preview failed');
    this.themeError =
      themeError ||
      `
      <p>${this.editor.t(
      <p>${Drupal.t(
        'An error occurred while trying to preview the media. Please save your work and reload this page.',
      )}<p>
    `;
+1 −2
Original line number Diff line number Diff line
@@ -18,11 +18,10 @@ export default class DrupalMediaToolbar extends Plugin {

  afterInit() {
    const editor = this.editor;
    const { t } = editor;
    const widgetToolbarRepository = editor.plugins.get(WidgetToolbarRepository);

    widgetToolbarRepository.register('drupalMedia', {
      ariaLabel: t('Drupal Media toolbar'),
      ariaLabel: Drupal.t('Drupal Media toolbar'),
      items: editor.config.get('drupalMedia.toolbar') || [],
      // Get the selected image or an image containing the figcaption with the selection inside.
      getRelatedElement: (selection) => getSelectedDrupalMediaWidget(selection),
+1 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ export default class DrupalMediaUI extends Plugin {
      const buttonView = new ButtonView(locale);

      buttonView.set({
        label: editor.t('Insert Drupal Media'),
        label: Drupal.t('Insert Drupal Media'),
        icon: mediaIcon,
        tooltip: true,
      });
Loading