Ajout des fonctions de gestion des soins
This commit is contained in:
@@ -73,6 +73,8 @@ export default class TravellerItemSheet extends HandlebarsApplicationMixin(found
|
||||
skills.sort(MGT2Helper.compareByName);
|
||||
skills = [{ _id: "NP", name: game.i18n.localize("MGT2.Items.NotProficient") }].concat(skills);
|
||||
|
||||
const enrich = (html) => foundry.applications.ux.TextEditor.implementation.enrichHTML(html ?? "", { async: true });
|
||||
|
||||
return {
|
||||
item: item,
|
||||
document: item,
|
||||
@@ -91,6 +93,10 @@ export default class TravellerItemSheet extends HandlebarsApplicationMixin(found
|
||||
weight: weight,
|
||||
unitlabels: { weight: MGT2Helper.getWeightLabel() },
|
||||
skills: skills,
|
||||
enrichedDescription: await enrich(item.system.description),
|
||||
enrichedDescriptionLong: await enrich(item.system.descriptionLong),
|
||||
enrichedNotes: await enrich(item.system.notes),
|
||||
enrichedLockedDescription: await enrich(item.system.lockedDescription),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -126,6 +132,27 @@ export default class TravellerItemSheet extends HandlebarsApplicationMixin(found
|
||||
bind(".options-delete", TravellerItemSheet.#onOptionDelete);
|
||||
bind(".modifiers-create", TravellerItemSheet.#onModifierCreate);
|
||||
bind(".modifiers-delete", TravellerItemSheet.#onModifierDelete);
|
||||
|
||||
// Activate ProseMirror editors for HTMLField fields
|
||||
for (const btn of html.querySelectorAll(".editor-edit")) {
|
||||
btn.addEventListener("click", async (event) => {
|
||||
event.preventDefault();
|
||||
const editorWrapper = btn.closest(".editor");
|
||||
if (!editorWrapper) return;
|
||||
const editorContent = editorWrapper.querySelector(".editor-content");
|
||||
if (!editorContent || editorContent.classList.contains("ProseMirror")) return;
|
||||
const target = editorContent.dataset.edit;
|
||||
const value = foundry.utils.getProperty(this.document, target) ?? "";
|
||||
btn.remove();
|
||||
editorWrapper.classList.add("prosemirror");
|
||||
await ProseMirrorEditor.create(editorContent, value, {
|
||||
document: this.document,
|
||||
fieldName: target,
|
||||
plugins: {},
|
||||
collaborate: false,
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
_activateTabGroups() {
|
||||
|
||||
Reference in New Issue
Block a user