Begin prototyping a popout text editor for use across multiple sheet types

This commit is contained in:
Oliver-Akins 2024-03-25 20:30:59 -06:00
parent 97af3801c4
commit 71684fcbe9
4 changed files with 64 additions and 0 deletions

View file

@ -0,0 +1,51 @@
export class PopoutTextEditor extends FormApplication {
/**
* Creates a form
*/
static create(value) {};
/** @override */
constructor(actor, property, options = {}) {
super(actor, options);
this.property = property;
};
static get defaultOptions() {
const opts = mergeObject({
...super.defaultOptions,
title: `Rich Text Editor`,
template: `systems/dotdungeon/templates/dialogs/text-editor.hbs`,
width: 500,
height: 600,
submitOnClose: false,
resizable: true,
});
return opts;
};
async getData() {
const ctx = await super.getData();
ctx.editor = {
engine: `prosemirror`,
collaborate: true,
content: await TextEditor.enrichHTML(
await getProperty(this.document, this.property),
{
relativeTo: this.object,
secrets: this.object.isOwner,
async: true
}
),
target: this.property,
};
return ctx;
};
async _updateObject(_event, formData) {
console.log(formData);
this.document.update({ [this.property]: formData["text"] })
};
};

View file

@ -0,0 +1,5 @@
.dialog--text-editor {
[role="application"] {
height: 100%;
}
}

View file

@ -9,6 +9,7 @@
@use "./global/design-v2.scss";
@use "./dialog/DiceList.scss";
@use "./dialog/text-editor.scss";
@use "./sheets/partials/stat.scss";
@use "./sheets/partials/skill.scss";

View file

@ -0,0 +1,7 @@
<form class="dialog--text-editor flexcol">
{{editor
editor.content
target=editor.target
collaborate=editor.collaborate
}}
</form>