Skip to content

Commit

Permalink
[foundryvtt#2211, foundryvtt#2231] Fix class journal sheet editor lay…
Browse files Browse the repository at this point in the history
…out & bugs
  • Loading branch information
arbron committed May 13, 2023
1 parent 1920b02 commit f48dbe7
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 7 deletions.
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
4 changes: 2 additions & 2 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 @@ -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
3 changes: 2 additions & 1 deletion module/applications/journal/journal-editor.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export default class JournalEditor extends DocumentSheet {
template: "systems/dnd5e/templates/journal/journal-editor.hbs",
width: 520,
height: 640,
textKeyPath: null
textKeyPath: null,
resizable: true
});
}

Expand Down

0 comments on commit f48dbe7

Please sign in to comment.