Forien / foundryvtt-forien-quest-log

This module provides comprehensive Quest Log system for players and Game Masters to use with Foundry Virtual Tabletop
MIT License
22 stars 35 forks source link

[BUG] Quest Preview TinyMCE editor not saved properly under FVTT 0.7.3+ #97

Open aaclayton opened 4 years ago

aaclayton commented 4 years ago

The TinyMCE editor in the QuestPreview app doesn't save properly anymore because of some changes to the FormApplication class in FVTT version 0.7.3+

You currently do this:

  /**
   * When editor is saved, we want to update and save quest.
   *
   * @param target
   * @param element
   * @param content
   * @returns {Promise<void>}
   * @private
   */
  async _onEditorSave(target, element, content) {
    this.quest[target] = content;
    this.saveQuest();
  }

Ths _onEditorSave() method no longer exists in the core FVTT code. You need to do something like this:

/** @override */
saveEditor(name) {
  const editor = this.editors[name];
  this.quest[name] = editor.mce.getContent();
  super.saveEditor(name);
  this.saveQuest();
}
alcobeard commented 3 years ago

didn't work fvtt 0.7.7

The TinyMCE editor in the QuestPreview app doesn't save properly anymore because of some changes to the FormApplication class in FVTT version 0.7.3+

You currently do this:

  /**
   * When editor is saved, we want to update and save quest.
   *
   * @param target
   * @param element
   * @param content
   * @returns {Promise<void>}
   * @private
   */
  async _onEditorSave(target, element, content) {
    this.quest[target] = content;
    this.saveQuest();
  }

Ths _onEditorSave() method no longer exists in the core FVTT code. You need to do something like this:

/** @override */
saveEditor(name) {
  const editor = this.editors[name];
  this.quest[name] = editor.mce.getContent();
  super.saveEditor(name);
  this.saveQuest();
}
dmkuda commented 3 years ago

didn't work fvtt 0.7.7

The TinyMCE editor in the QuestPreview app doesn't save properly anymore because of some changes to the FormApplication class in FVTT version 0.7.3+ You currently do this:

  /**
   * When editor is saved, we want to update and save quest.
   *
   * @param target
   * @param element
   * @param content
   * @returns {Promise<void>}
   * @private
   */
  async _onEditorSave(target, element, content) {
    this.quest[target] = content;
    this.saveQuest();
  }

Ths _onEditorSave() method no longer exists in the core FVTT code. You need to do something like this:

/** @override */
saveEditor(name) {
  const editor = this.editors[name];
  this.quest[name] = editor.mce.getContent();
  super.saveEditor(name);
  this.saveQuest();
}

Make sure async_onEditorSave is replaced. Replace that whole section with this, and it will work:

 /**
   * When editor is saved, we want to update and save quest.
   *
   * @param target
   * @param element
   * @param content
   * @returns {Promise<void>}
   * @private
   */

   saveEditor(name) {
    const editor = this.editors[name];
    this.quest[name] = editor.mce.getContent();
    super.saveEditor(name);
    this.saveQuest();  
  }
alcobeard commented 3 years ago

my damn eyes.......it was night already yesterday in Moscow when I tried to fix it, so I was trying to change these lines in quest-form app, not in QuestPreview. Thanks a lot!

didn't work fvtt 0.7.7

The TinyMCE editor in the QuestPreview app doesn't save properly anymore because of some changes to the FormApplication class in FVTT version 0.7.3+ You currently do this:

  /**
   * When editor is saved, we want to update and save quest.
   *
   * @param target
   * @param element
   * @param content
   * @returns {Promise<void>}
   * @private
   */
  async _onEditorSave(target, element, content) {
    this.quest[target] = content;
    this.saveQuest();
  }

Ths _onEditorSave() method no longer exists in the core FVTT code. You need to do something like this:

/** @override */
saveEditor(name) {
  const editor = this.editors[name];
  this.quest[name] = editor.mce.getContent();
  super.saveEditor(name);
  this.saveQuest();
}

Make sure async_onEditorSave is replaced. Replace that whole section with this, and it will work:

 /**
   * When editor is saved, we want to update and save quest.
   *
   * @param target
   * @param element
   * @param content
   * @returns {Promise<void>}
   * @private
   */

   saveEditor(name) {
      const editor = this.editors[name];
      this.quest[name] = editor.mce.getContent();
      super.saveEditor(name);
      this.saveQuest();  
  }