メインコンテンツに移動

メインナビゲーション

  • ホーム
  • サイトマップ
  • ビデオ
  • ご連絡

パンくず

  • ホーム
  • wysiwyg_imagefieldで挿入した画像がコンテンツ更新時に消えた

wysiwyg_imagefieldで挿入した画像がコンテンツ更新時に消えた

drupal
drupal
wysiwyg module
rich text editor

インストールされているモジュール

  • WYSIWYG 7.x-2.2
  • wysiwyg_imagefield 7.x-1.x-dev
  • CKEditor 4.4.38

現象の再現

  • コンテンツ(例:node)を作成し、CKEditorでコンテンツを編集する
  • wysiwyg_imagefieldを利用して、画像をコンテンツに挿入して、コンテンツを保存する
  • コンテンツに挿入された画像が正常に表示される
  • 再度コンテンツを編集CKEditorで編集し、wysiwyg_imagefieldを開かずに保存する
  • コンテンツに挿入された画像が消えた(表示された場合はキャッシュの原因で、F5を押すと画像が消える)

原因/解決

  • wysiwyg_imagefieldが画像挿入画面を開かないと、保存された画像がロードされず、システムがImageフィールドの画像が消されたと見なす
  • 解決には、以下のコード(Drupal.wysiwygImageField.focus())を sites\all\modules\wysiwyg_imagefield\puugins\wysiwyg_imagefield\wysiwyg_imagefield.js に追加する
    /**
     * Create wysiwyg_imagefield dialog window.
     */
    attach: function(content, settings, instanceId) {
      // @TODO: Use Modal Frame API if available.
      $('#wysiwyg_imagefield-wrapper').dialog({
        autoOpen: false,
        modal: true,
        title: Drupal.settings.WysiwygImageField.title
      });
      Drupal.wysiwygImageField.init();
      Drupal.wysiwygImageField.focus();
      return content;
    },
  • 注意点:JSがDrupalにキャッシュされるので、キャッシュクリア(Home » Administration » Configuration » Development)ボタンをクリックして、JSを更新します。
ホーム

古松

検索

Article Category

  • apache(7)
  • css(19)
  • drupal(295)
  • Electron(4)
  • html(34)
  • javascript(27)
  • laravel(4)
  • linux(5)
  • macOS(2)
  • mysql(13)
  • php(19)
  • python(4)
  • SEO(12)
  • video(72)
  • Visual Studio Code(4)
  • windows(13)
  • wordpress(32)