Quest
Quest description.
From 5efa38d46a41e915209fe5742fa3f0bb932df9c4 Mon Sep 17 00:00:00 2001
From: Tyler <3deathsaves@gmail.com>
Date: Thu, 11 Jun 2026 22:53:27 -0600
Subject: [PATCH 1/2] Add ProseMirror inserts for the system's HTML blocks
- Add module/inserts.mjs registering CONFIG.TextEditor.inserts
- Group notable, narrative, quest, advice, pull quote, and habitat & treasure under a "D&D Blocks" menu
- Wire registration into init and expose on the dnd5e API
- Add EDITOR.DND5E.Inserts localization keys
---
dnd5e.mjs | 6 +++++
lang/en.json | 14 ++++++++++++
module/inserts.mjs | 56 ++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 76 insertions(+)
create mode 100644 module/inserts.mjs
diff --git a/dnd5e.mjs b/dnd5e.mjs
index 561f8e1618..7312b22eb3 100644
--- a/dnd5e.mjs
+++ b/dnd5e.mjs
@@ -23,6 +23,7 @@ import * as dice from "./module/dice/_module.mjs";
import * as documents from "./module/documents/_module.mjs";
import * as enrichers from "./module/enrichers.mjs";
import * as Filter from "./module/filter.mjs";
+import * as inserts from "./module/inserts.mjs";
import * as migrations from "./module/migration.mjs";
import { registerModuleData, registerModuleRedirects, setupModulePacks } from "./module/module-registration.mjs";
import { default as registry } from "./module/registry.mjs";
@@ -43,6 +44,7 @@ globalThis.dnd5e = {
documents,
enrichers,
Filter,
+ inserts,
migrations,
registry,
ui: {},
@@ -229,6 +231,9 @@ Hooks.once("init", function() {
// Enrichers
enrichers.registerCustomEnrichers();
+ // ProseMirror inserts
+ inserts.registerProseMirrorInserts();
+
// Exhaustion handling
documents.ActiveEffect5e.registerHUDListeners();
@@ -670,6 +675,7 @@ export {
documents,
enrichers,
Filter,
+ inserts,
migrations,
registry,
utils,
diff --git a/lang/en.json b/lang/en.json
index fe302b7c2f..cd997778e6 100644
--- a/lang/en.json
+++ b/lang/en.json
@@ -7,6 +7,20 @@
}
},
+"EDITOR.DND5E": {
+ "Inserts": {
+ "Group": "D&D Blocks",
+ "Notable": "Notable",
+ "Narrative": "Narrative",
+ "Quest": "Quest",
+ "Advice": "Advice",
+ "Quote": "Pull Quote",
+ "FloatLeft": "Float Left",
+ "FloatRight": "Float Right",
+ "HabitatTreasure": "Habitat & Treasure"
+ }
+},
+
"TYPES.Actor.character": "Player Character",
"TYPES.Actor.characterPl": "Player Characters",
"TYPES.Actor.encounter": "Encounter",
diff --git a/module/inserts.mjs b/module/inserts.mjs
new file mode 100644
index 0000000000..f963f21d34
--- /dev/null
+++ b/module/inserts.mjs
@@ -0,0 +1,56 @@
+/**
+ * Register the system's special HTML blocks as ProseMirror inserts.
+ */
+export function registerProseMirrorInserts() {
+ CONFIG.TextEditor.inserts.push({
+ action: "dnd5e-blocks",
+ title: "EDITOR.DND5E.Inserts.Group",
+ children: [
+ {
+ action: "dnd5e-block-notable",
+ title: "EDITOR.DND5E.Inserts.Notable",
+ html: ''
+ },
+ {
+ action: "dnd5e-block-narrative",
+ title: "EDITOR.DND5E.Inserts.Narrative",
+ html: ''
+ },
+ {
+ action: "dnd5e-block-quest",
+ title: "EDITOR.DND5E.Inserts.Quest",
+ html: ' Quest description. Advice content.Quest
Advice
Habitat: Any; Treasure: None
' + } + ] + }); +} From 73b83e57655b3365b12e364edb0295ea6f9568e4 Mon Sep 17 00:00:00 2001 From: Tyler <3deathsaves@gmail.com> Date: Fri, 12 Jun 2026 00:37:39 -0600 Subject: [PATCH 2/2] Add ProseMirror inserts for the system's enrichers - Add a "D&D Enrichers" group built dynamically from CONFIG.DND5E: checks, saves, skills, damage, awards, attack, item, lookup, and references - Resolve reference rule titles from their compendium pages; alphabetize submenus, keeping abilities in stat order - Register on the ready hook; scroll and title-case the editor dropdown entries - Add EDITOR.DND5E.Inserts enricher localization keys --- dnd5e.mjs | 6 +- lang/en.json | 12 +++- less/v2/apps.less | 7 +++ module/inserts.mjs | 145 ++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 164 insertions(+), 6 deletions(-) diff --git a/dnd5e.mjs b/dnd5e.mjs index 7312b22eb3..7440b65761 100644 --- a/dnd5e.mjs +++ b/dnd5e.mjs @@ -231,9 +231,6 @@ Hooks.once("init", function() { // Enrichers enrichers.registerCustomEnrichers(); - // ProseMirror inserts - inserts.registerProseMirrorInserts(); - // Exhaustion handling documents.ActiveEffect5e.registerHUDListeners(); @@ -553,6 +550,9 @@ Hooks.once("ready", function() { // Adjust sourced items on actors now that compendium UUID redirects have been initialized game.actors.forEach(a => a.sourcedItems._redirectKeys()); + // ProseMirror inserts (after compendia are available so reference rule titles can resolve) + inserts.registerProseMirrorInserts(); + // Register items by type dnd5e.registry.classes.initialize(); dnd5e.registry.subclasses.initialize(); diff --git a/lang/en.json b/lang/en.json index cd997778e6..95f5579f60 100644 --- a/lang/en.json +++ b/lang/en.json @@ -17,7 +17,17 @@ "Quote": "Pull Quote", "FloatLeft": "Float Left", "FloatRight": "Float Right", - "HabitatTreasure": "Habitat & Treasure" + "HabitatTreasure": "Habitat & Treasure", + "EnrichersGroup": "D&D Enrichers", + "Check": "Ability Check", + "Save": "Saving Throw", + "Skill": "Skill Check", + "Damage": "Damage", + "Attack": "Attack Roll", + "Award": "Award", + "Item": "Item", + "Reference": "Reference", + "Lookup": "Lookup" } }, diff --git a/less/v2/apps.less b/less/v2/apps.less index 99ab0337a7..b1fd9ecc34 100644 --- a/less/v2/apps.less +++ b/less/v2/apps.less @@ -2100,6 +2100,13 @@ dialog.dnd5e2.application { ul { box-shadow: 0 3px 6px var(--dnd5e-shadow-45); } li.divider { border-color: #ddd; } + li[data-action^="dnd5e-"] > span { text-transform: capitalize; } + + ul:has(> li[data-action^="dnd5e-"]):not(:has(> li > ul)) { + max-height: 50vh; + overflow: hidden auto; + } + &.theme-dark { --dropdown-background: var(--dnd5e-color-blue-gray-2); --dropdown-border: transparent; diff --git a/module/inserts.mjs b/module/inserts.mjs index f963f21d34..ce0c678392 100644 --- a/module/inserts.mjs +++ b/module/inserts.mjs @@ -1,7 +1,75 @@ /** - * Register the system's special HTML blocks as ProseMirror inserts. + * Build inline enricher inserts for each entry in a config record, titled by the entry's label. + * @param {string} prefix Action id prefix for each generated child. + * @param {Record