diff --git a/module/apps/rdd-text-roll-editor.js b/module/apps/rdd-text-roll-editor.js index 1cadfbfa..33463eca 100644 --- a/module/apps/rdd-text-roll-editor.js +++ b/module/apps/rdd-text-roll-editor.js @@ -9,16 +9,17 @@ import { TextRollManager } from "./textroll/text-roll-formatter.js"; const TEXT_ROLL_MANAGERS = [ new TextRollAlchimie(), new TextRollCaracCompetence(), - new TextRollFormula()]; + new TextRollFormula()] export class RdDTextEditor { static registerChatCallbacks(html) { html.on("click", '.roll-text', async event => await RdDTextEditor.rollText(event)) } - static async enrichHTML(text, object, options = {}) { + static async enrichHTML(text, object, options = {showlink:true}) { const context = { - text, object, + text, + object, options, competences: await SystemCompendiums.getCompetences(ACTOR_TYPES.personnage), } @@ -29,7 +30,6 @@ export class RdDTextEditor { context.text = await manager.onReplaceRoll(context); } - // TEXT_ROLL_MANAGERS.forEach(async manager => await RdDTextEditor._applyReplaceAll(manager, context)) return await TextEditor.enrichHTML(context.text, { relativeTo: object, secrets: object?.isOwner, diff --git a/module/apps/textroll/text-roll-carac-competence.js b/module/apps/textroll/text-roll-carac-competence.js index 1f0f23c2..c7511696 100644 --- a/module/apps/textroll/text-roll-carac-competence.js +++ b/module/apps/textroll/text-roll-carac-competence.js @@ -5,7 +5,10 @@ import { RdDItemCompetence } from "../../item-competence.js"; import { RdDUtility } from "../../rdd-utility.js"; import { TextRollManager } from "./text-roll-formatter.js"; -const REGEXP_ROLL_CARAC_COMP = "(?[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+)(\\/(?[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+))?(/(?[\\+\\-]?\\d+))?" +const REGECP_CARAC = "(?[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+)" +const REGEXP_COMP = "(\\/(?[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+))?" +const REGEXP_DIFF = "(/(?[\\+\\-]?\\d+))?" +const REGEXP_ROLL_CARAC_COMP = REGECP_CARAC + REGEXP_COMP + REGEXP_DIFF const XREGEXP_ROLL_CARAC_COMP = XRegExp("@roll\\[" + REGEXP_ROLL_CARAC_COMP + "\\]", 'giu') /** diff --git a/templates/apps/textroll/link-text-roll-carac-competence.hbs b/templates/apps/textroll/link-text-roll-carac-competence.hbs index af0528c8..212628a7 100644 --- a/templates/apps/textroll/link-text-roll-carac-competence.hbs +++ b/templates/apps/textroll/link-text-roll-carac-competence.hbs @@ -2,8 +2,8 @@ data-code="{{param.code}}" data-json="{{json-stringify param}}" data-carac-code="{{param.carac.code}}" - {{#if competence}}data-competence="{{param.competence}}"{{/if~}} - {{#if diff}}data-diff="{{param.diff}}"{{/if~}}> + {{#if param.competence}}data-competence="{{param.competence}}"{{/if~}} + {{#if param.diff}}data-diff="{{param.diff}}"{{/if~}}> {{~uppercase param.carac.label~}} {{#if param.competence}} / {{upperFirst param.competence}}{{/if~}}