Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#2211, #2231] Fix class journal sheet editor layout & bugs #2280

Merged
merged 2 commits into from
May 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions dnd5e.css
Original file line number Diff line number Diff line change
Expand Up @@ -1849,8 +1849,18 @@ h5 {
/* ----------------------------------------- */
/* Journal Pages */
/* ----------------------------------------- */
.journal-editor .tox-tinymce {
height: 100% !important;
.journal-editor {
min-width: 340px;
min-height: 260px;
}
.journal-editor .window-content {
padding: 0;
}
.journal-editor .prosemirror menu {
border-radius: 0;
}
.journal-editor .prosemirror .editor-container {
overflow-y: auto;
}
.journal-entry-page.class h4,
.class-journal h4 {
Expand Down
15 changes: 13 additions & 2 deletions less/journal.less
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,19 @@
/* ----------------------------------------- */

.journal-editor {
.tox-tinymce {
height: 100% !important;
min-width: 340px;
min-height: 260px;

.window-content {
padding: 0;
}
.prosemirror {
menu {
border-radius: 0;
}
.editor-container {
overflow-y: auto;
}
}
}

Expand Down
8 changes: 4 additions & 4 deletions module/applications/journal/class-sheet.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default class JournalClassPageSheet extends JournalPageSheet {
_getAdvancement(item) {
const advancement = {};

const hp = item.advancement.byType.HitPoints[0];
const hp = item.advancement.byType.HitPoints?.[0];
if ( hp ) {
advancement.hp = {
hitDice: `1${hp.hitDie}`,
Expand Down Expand Up @@ -147,7 +147,7 @@ export default class JournalClassPageSheet extends JournalPageSheet {
case "ItemGrant":
if ( advancement.configuration.optional ) continue;
features.push(...await Promise.all(advancement.configuration.items.map(makeLink)));
continue;
break;
}
}

Expand Down Expand Up @@ -282,7 +282,7 @@ export default class JournalClassPageSheet extends JournalPageSheet {
case "ItemGrant":
if ( !advancement.configuration.optional ) continue;
features.push(...await Promise.all(advancement.configuration.items.map(makeLink)));
continue;
break;
}
}
if ( !features.length ) continue;
Expand Down Expand Up @@ -423,7 +423,7 @@ export default class JournalClassPageSheet extends JournalPageSheet {
*/
_onLaunchTextEditor(event) {
event.preventDefault();
const textKeyPath = event.target.dataset.target;
const textKeyPath = event.currentTarget.dataset.target;
const label = event.target.closest(".form-group").querySelector("label");
const editor = new JournalEditor(this.document, { textKeyPath, title: label?.innerText });
editor.render(true);
Expand Down
5 changes: 3 additions & 2 deletions module/applications/journal/journal-editor.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ export default class JournalEditor extends DocumentSheet {
return foundry.utils.mergeObject(super.defaultOptions, {
classes: ["journal-editor"],
template: "systems/dnd5e/templates/journal/journal-editor.hbs",
width: 520,
width: 550,
height: 640,
textKeyPath: null
textKeyPath: null,
resizable: true
});
}

Expand Down