Added convertSymbol for item's desc and actor's notes

This commit is contained in:
Vlyan
2021-01-02 12:35:08 +01:00
parent 2ceb501543
commit 331872e84f
6 changed files with 71 additions and 36 deletions

View File

@@ -48,6 +48,34 @@ export class ItemSheetL5r5e extends ItemSheet {
}
}
/**
* Activate a named TinyMCE text editor
* @param {string} name The named data field which the editor modifies.
* @param {object} options TinyMCE initialization options passed to TextEditor.create
* @param {string} initialContent Initial text content for the editor area.
* @override
*/
activateEditor(name, options = {}, initialContent = "") {
if (name === "data.description" && initialContent) {
initialContent = game.l5r5e.HelpersL5r5e.convertSymbols(initialContent, false);
}
super.activateEditor(name, options, initialContent);
}
/**
* This method is called upon form submission after form data is validated
* @param event {Event} The initial triggering submission event
* @param formData {Object} The object of validated form data with which to update the object
* @returns {Promise} A Promise which resolves once the update operation has completed
* @override
*/
async _updateObject(event, formData) {
if (formData["data.description"]) {
formData["data.description"] = game.l5r5e.HelpersL5r5e.convertSymbols(formData["data.description"], true);
}
return super._updateObject(event, formData);
}
/**
* Subscribe to events from the sheet.
* @param html HTML content of the sheet.
@@ -79,15 +107,6 @@ export class ItemSheetL5r5e extends ItemSheet {
});
}
/**
* Update the item with data from the sheet.
* @param event
* @param formData
*/
_updateObject(event, formData) {
return this.object.update(formData);
}
/**
* Create drag-and-drop workflow handlers for this Application
* @return An array of DragDrop handlers