diff --git a/CHANGELOG.md b/CHANGELOG.md
index 058f15f..957585b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,12 +3,14 @@ Date format : day/month/year
## 1.7.2 - ??/??/2022 - ?
- Added 179 Japanese' style villages name table.
+- Added Rōnin icon tag symbol (thanks to TesserWract).
- Fixed : Missing translation for EN and ES - "Armors, Weapons, and Items" in Npc Generator dialog.
- Compendium : Updated Weapon Names and Grips, thanks to TesserWract :
- Added "N/A" to invalid weapon grips.
- Grips with more than one quality and/or style now use a more consistent format: "(style): Quality 1, Quality 2, ..."
- Renamed "Tinbe-Rochin" to "Rochin" as the DB entry is for the single item rather than the item pair.
- Added macrons to relevant weapon names.
+- Refactor the way of symbols was handled, now compatible with "monks enhanced journal".
## 1.7.1 - 01/04/2022 - Spring fixes
- PC/NPC sheet :
diff --git a/system/scripts/actors/army-sheet.js b/system/scripts/actors/army-sheet.js
index c2b5962..8a55fb6 100644
--- a/system/scripts/actors/army-sheet.js
+++ b/system/scripts/actors/army-sheet.js
@@ -78,29 +78,13 @@ export class ArmySheetL5r5e extends BaseSheetL5r5e {
* @override
*/
activateEditor(name, options = {}, initialContent = "") {
+ // Symbols Compatibility with old compendium modules (PRE l5r v1.7.2)
if (["data.army_abilities", "data.supplies_logistics", "data.past_battles"].includes(name) && 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) {
- ["data.army_abilities", "data.supplies_logistics", "data.past_battles"].forEach((name) => {
- if (!formData[name]) {
- return;
- }
- formData[name] = game.l5r5e.HelpersL5r5e.convertSymbols(formData[name], true);
- });
- return super._updateObject(event, formData);
- }
-
/**
* Subscribe to events from the sheet.
* @param {jQuery} html HTML content of the sheet.
diff --git a/system/scripts/actors/base-sheet.js b/system/scripts/actors/base-sheet.js
index bb604c3..f326f0a 100644
--- a/system/scripts/actors/base-sheet.js
+++ b/system/scripts/actors/base-sheet.js
@@ -104,6 +104,7 @@ export class BaseSheetL5r5e extends ActorSheet {
* @override
*/
activateEditor(name, options = {}, initialContent = "") {
+ // Symbols Compatibility with old compendium modules (PRE l5r v1.7.2)
if (["data.notes", "data.description"].includes(name) && initialContent) {
initialContent = game.l5r5e.HelpersL5r5e.convertSymbols(initialContent, false);
}
@@ -123,14 +124,6 @@ export class BaseSheetL5r5e extends ActorSheet {
delete formData["autoCompleteListName"];
delete formData["autoCompleteListSelectedIndex"];
}
-
- // Symbols
- ["data.notes", "data.description"].forEach((name) => {
- if (!formData[name]) {
- return;
- }
- formData[name] = game.l5r5e.HelpersL5r5e.convertSymbols(formData[name], true);
- });
return super._updateObject(event, formData);
}
diff --git a/system/scripts/handlebars.js b/system/scripts/handlebars.js
index 0811a53..6d6378a 100644
--- a/system/scripts/handlebars.js
+++ b/system/scripts/handlebars.js
@@ -47,7 +47,7 @@ export const RegisterHandlebars = function () {
/* ------------------------------------ */
/* Utility */
/* ------------------------------------ */
- // Json - Display a object in textarea (for debug)
+ // Json - Display an object in textarea (for debug)
Handlebars.registerHelper("json", function (...objects) {
objects.pop(); // remove this function call
return new Handlebars.SafeString(objects.map((e) => ``));
@@ -64,6 +64,11 @@ export const RegisterHandlebars = function () {
return objects.join("");
});
+ // enrichHTML
+ Handlebars.registerHelper("enrichHTML", function (text, options = {}) {
+ return TextEditor.enrichHTML(text, options);
+ });
+
// Add a setter
Handlebars.registerHelper("setVar", function (varName, varValue, options) {
options.data.root[varName] = varValue;
diff --git a/system/scripts/items/army-cohort-sheet.js b/system/scripts/items/army-cohort-sheet.js
index aff8682..783a4fa 100644
--- a/system/scripts/items/army-cohort-sheet.js
+++ b/system/scripts/items/army-cohort-sheet.js
@@ -48,26 +48,13 @@ export class ArmyCohortSheetL5r5e extends ItemSheetL5r5e {
* @override
*/
activateEditor(name, options = {}, initialContent = "") {
+ // Symbols Compatibility with old compendium modules (PRE l5r v1.7.2)
if (name === "data.abilities" && 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.abilities"]) {
- formData["data.abilities"] = game.l5r5e.HelpersL5r5e.convertSymbols(formData["data.abilities"], true);
- }
- return super._updateObject(event, formData);
- }
-
/**
* Subscribe to events from the sheet.
* @param {jQuery} html HTML content of the sheet.
diff --git a/system/scripts/items/base-item-sheet.js b/system/scripts/items/base-item-sheet.js
index 9243fed..f1df150 100644
--- a/system/scripts/items/base-item-sheet.js
+++ b/system/scripts/items/base-item-sheet.js
@@ -61,29 +61,13 @@ export class BaseItemSheetL5r5e extends ItemSheet {
* @override
*/
activateEditor(name, options = {}, initialContent = "") {
+ // Symbols Compatibility with old compendium modules (PRE l5r v1.7.2)
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"]) {
- // Base links (Journal, compendiums...)
- formData["data.description"] = TextEditor.enrichHTML(formData["data.description"]);
- // L5R Symbols
- formData["data.description"] = game.l5r5e.HelpersL5r5e.convertSymbols(formData["data.description"], true);
- }
- return super._updateObject(event, formData);
- }
-
/**
* Subscribe to events from the sheet.
* @param {jQuery} html HTML content of the sheet.
diff --git a/system/scripts/journals/base-journal-sheet.js b/system/scripts/journals/base-journal-sheet.js
index 54f8539..9bcab14 100644
--- a/system/scripts/journals/base-journal-sheet.js
+++ b/system/scripts/journals/base-journal-sheet.js
@@ -46,26 +46,13 @@ export class BaseJournalSheetL5r5e extends JournalSheet {
* @override
*/
activateEditor(name, options = {}, initialContent = "") {
+ // For Compatibility with old compendium modules (PRE l5r v1.7.2)
if (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.content) {
- formData.content = game.l5r5e.HelpersL5r5e.convertSymbols(formData.content, true);
- }
- return super._updateObject(event, formData);
- }
-
/**
* Subscribe to events from the sheet.
* @param {jQuery} html HTML content of the sheet.
diff --git a/system/scripts/main-l5r5e.js b/system/scripts/main-l5r5e.js
index 68824cd..b1f6d50 100644
--- a/system/scripts/main-l5r5e.js
+++ b/system/scripts/main-l5r5e.js
@@ -200,6 +200,12 @@ Hooks.once("init", async () => {
makeDefault: true,
});
+ // Override enrichHTML for Symbol replacement
+ const oldEnrichHTML = TextEditor.prototype.constructor.enrichHTML;
+ TextEditor.prototype.constructor.enrichHTML = function (content, options = {}) {
+ return HelpersL5r5e.convertSymbols(oldEnrichHTML.call(this, content, options), true);
+ };
+
// Override the default Token _drawBar function to allow fatigue bar reversing.
Token.prototype._drawBar = function (number, bar, data) {
const reverseBar = data.attribute === "fatigue" && game.settings.get("l5r5e", "token-reverseFatigueBar");
diff --git a/system/templates/actors/actor-text.html b/system/templates/actors/actor-text.html
index 3af32e9..989fbef 100644
--- a/system/templates/actors/actor-text.html
+++ b/system/templates/actors/actor-text.html
@@ -6,6 +6,6 @@
{{{data.data.description}}} {{{enrichHTML data.data.description}}}
{{{actorData.data.description}}}
+{{{enrichHTML actorData.data.description}}}
{{!-- Cohorts --}} {{#if actorData.splitItemsList.army_cohort}} diff --git a/system/templates/gm/monitor-tooltips/global.html b/system/templates/gm/monitor-tooltips/global.html index f059a78..1a5b0bc 100644 --- a/system/templates/gm/monitor-tooltips/global.html +++ b/system/templates/gm/monitor-tooltips/global.html @@ -17,5 +17,5 @@{{{actorData.description}}}
+{{{enrichHTML actorData.description}}}
\ No newline at end of file diff --git a/system/templates/items/advancement/advancement-text.html b/system/templates/items/advancement/advancement-text.html index ffd761a..5fc8bee 100644 --- a/system/templates/items/advancement/advancement-text.html +++ b/system/templates/items/advancement/advancement-text.html @@ -17,7 +17,7 @@{{localize 'l5r5e.sheets.description'}} : {{{data.data.description}}}
+{{localize 'l5r5e.sheets.description'}} : {{{enrichHTML data.data.description}}}
{{localize 'l5r5e.sheets.book_reference'}} : {{data.data.book_reference}}
diff --git a/system/templates/items/armor/armor-text.html b/system/templates/items/armor/armor-text.html index 0aa0abb..27c9892 100644 --- a/system/templates/items/armor/armor-text.html +++ b/system/templates/items/armor/armor-text.html @@ -36,7 +36,7 @@ {{#each data.data.properties as |property idx|}}{{#ifCond idx '>' 0}}, {{/ifCond}}{{property.name}}{{/each}} {{!--item-infos--}} -{{localize 'l5r5e.sheets.description'}} : {{{data.data.description}}}
+{{localize 'l5r5e.sheets.description'}} : {{{enrichHTML data.data.description}}}
{{localize 'l5r5e.sheets.book_reference'}} : {{data.data.book_reference}}
diff --git a/system/templates/items/army-cohort/army-cohort-text.html b/system/templates/items/army-cohort/army-cohort-text.html index 8c05fbb..d25b061 100644 --- a/system/templates/items/army-cohort/army-cohort-text.html +++ b/system/templates/items/army-cohort/army-cohort-text.html @@ -13,9 +13,9 @@{{localize 'l5r5e.army.cohort.abilities'}} : {{{data.data.abilities}}}
+{{localize 'l5r5e.army.cohort.abilities'}} : {{{enrichHTML data.data.abilities}}}
{{!--item-infos--}} -{{localize 'l5r5e.sheets.description'}} : {{{data.data.description}}}
+{{localize 'l5r5e.sheets.description'}} : {{{enrichHTML data.data.description}}}
{{localize 'l5r5e.sheets.book_reference'}} : {{data.data.book_reference}}
\ No newline at end of file diff --git a/system/templates/items/army-fortification/army-fortification-text.html b/system/templates/items/army-fortification/army-fortification-text.html index 243bae1..2afcc75 100644 --- a/system/templates/items/army-fortification/army-fortification-text.html +++ b/system/templates/items/army-fortification/army-fortification-text.html @@ -8,7 +8,7 @@{{localize 'l5r5e.sheets.description'}} : {{{data.data.description}}}
+{{localize 'l5r5e.sheets.description'}} : {{{enrichHTML data.data.description}}}
{{localize 'l5r5e.sheets.book_reference'}} : {{data.data.book_reference}}
\ No newline at end of file diff --git a/system/templates/items/bond/bond-text.html b/system/templates/items/bond/bond-text.html index bd9d1df..7e02e98 100644 --- a/system/templates/items/bond/bond-text.html +++ b/system/templates/items/bond/bond-text.html @@ -26,7 +26,7 @@ {{#each data.data.properties as |property idx|}}{{#ifCond idx '>' 0}}, {{/ifCond}}{{property.name}}{{/each}} {{!--item-infos--}} -{{localize 'l5r5e.sheets.description'}} : {{{data.data.description}}}
+{{localize 'l5r5e.sheets.description'}} : {{{enrichHTML data.data.description}}}
{{localize 'l5r5e.sheets.book_reference'}} : {{data.data.book_reference}}
diff --git a/system/templates/items/item-pattern/item-pattern-text.html b/system/templates/items/item-pattern/item-pattern-text.html index 806f4db..3a88c6d 100644 --- a/system/templates/items/item-pattern/item-pattern-text.html +++ b/system/templates/items/item-pattern/item-pattern-text.html @@ -13,7 +13,7 @@ {{!--Linked property--}} {{localize 'l5r5e.sheets.linked_property'}} : {{{data.linkedProperty.name}}} {{!--item-infos--}} -{{localize 'l5r5e.sheets.description'}} : {{{data.data.description}}}
+{{localize 'l5r5e.sheets.description'}} : {{{enrichHTML data.data.description}}}
{{localize 'l5r5e.sheets.book_reference'}} : {{data.data.book_reference}}
diff --git a/system/templates/items/item/item-text.html b/system/templates/items/item/item-text.html index 760cb4a..a9e98b9 100644 --- a/system/templates/items/item/item-text.html +++ b/system/templates/items/item/item-text.html @@ -30,7 +30,7 @@ {{#each data.data.properties as |property idx|}}{{#ifCond idx '>' 0}}, {{/ifCond}}{{property.name}}{{/each}} {{!--item-infos--}} -{{localize 'l5r5e.sheets.description'}} : {{{data.data.description}}}
+{{localize 'l5r5e.sheets.description'}} : {{{enrichHTML data.data.description}}}
{{localize 'l5r5e.sheets.book_reference'}} : {{data.data.book_reference}}
diff --git a/system/templates/items/peculiarity/peculiarity-text.html b/system/templates/items/peculiarity/peculiarity-text.html index 0df7f36..780f3f1 100644 --- a/system/templates/items/peculiarity/peculiarity-text.html +++ b/system/templates/items/peculiarity/peculiarity-text.html @@ -27,7 +27,7 @@ {{!--item-infos--}} -{{localize 'l5r5e.sheets.description'}} : {{{data.data.description}}}
+{{localize 'l5r5e.sheets.description'}} : {{{enrichHTML data.data.description}}}
{{localize 'l5r5e.sheets.book_reference'}} : {{data.data.book_reference}}
diff --git a/system/templates/items/property/property-text.html b/system/templates/items/property/property-text.html index 57e8019..5b2d2ca 100644 --- a/system/templates/items/property/property-text.html +++ b/system/templates/items/property/property-text.html @@ -11,7 +11,7 @@ {{!--item-infos--}} -{{localize 'l5r5e.sheets.description'}} : {{{data.data.description}}}
+{{localize 'l5r5e.sheets.description'}} : {{{enrichHTML data.data.description}}}
{{localize 'l5r5e.sheets.book_reference'}} : {{data.data.book_reference}}
diff --git a/system/templates/items/signature-scroll/signature-scroll-text.html b/system/templates/items/signature-scroll/signature-scroll-text.html index 200c02e..21460c5 100644 --- a/system/templates/items/signature-scroll/signature-scroll-text.html +++ b/system/templates/items/signature-scroll/signature-scroll-text.html @@ -18,7 +18,7 @@ {{!--item-infos--}} -{{localize 'l5r5e.sheets.description'}} : {{{data.data.description}}}
+{{localize 'l5r5e.sheets.description'}} : {{{enrichHTML data.data.description}}}
{{localize 'l5r5e.sheets.book_reference'}} : {{data.data.book_reference}}
diff --git a/system/templates/items/technique/technique-text.html b/system/templates/items/technique/technique-text.html index f2658a1..707f9a4 100644 --- a/system/templates/items/technique/technique-text.html +++ b/system/templates/items/technique/technique-text.html @@ -33,7 +33,7 @@ {{!--item-infos--}} -{{localize 'l5r5e.sheets.description'}} : {{{data.data.description}}}
+{{localize 'l5r5e.sheets.description'}} : {{{enrichHTML data.data.description}}}
{{localize 'l5r5e.sheets.book_reference'}} : {{data.data.book_reference}}
diff --git a/system/templates/items/title/title-text.html b/system/templates/items/title/title-text.html index 98850db..57b22a3 100644 --- a/system/templates/items/title/title-text.html +++ b/system/templates/items/title/title-text.html @@ -30,7 +30,7 @@ {{/if}} {{!--item-infos--}} -{{localize 'l5r5e.sheets.description'}} : {{{data.data.description}}}
+{{localize 'l5r5e.sheets.description'}} : {{{enrichHTML data.data.description}}}
{{localize 'l5r5e.sheets.book_reference'}} : {{data.data.book_reference}}
diff --git a/system/templates/items/weapon/weapon-text.html b/system/templates/items/weapon/weapon-text.html index 87fc50b..4d7f691 100644 --- a/system/templates/items/weapon/weapon-text.html +++ b/system/templates/items/weapon/weapon-text.html @@ -52,7 +52,7 @@ {{#each data.data.properties as |property idx|}}{{#ifCond idx '>' 0}}, {{/ifCond}}{{property.name}}{{/each}} {{!--item-infos--}} -{{localize 'l5r5e.sheets.description'}} : {{{data.data.description}}}
+{{localize 'l5r5e.sheets.description'}} : {{{enrichHTML data.data.description}}}
{{localize 'l5r5e.sheets.book_reference'}} : {{data.data.book_reference}}
diff --git a/system/templates/journal/journal-text.html b/system/templates/journal/journal-text.html index e052a85..a9e8094 100644 --- a/system/templates/journal/journal-text.html +++ b/system/templates/journal/journal-text.html @@ -7,7 +7,7 @@
{{#if data.content}}
- {{{data.content}}}
+ {{{enrichHTML data.content}}}
{{else}}
{{#if data.img}}{{/if}}
{{/if}}