Skip to content

Commit dd456c1

Browse files
authored
Merge pull request #2214 from keithcurtis1/master
Supernotes and Image Editor Updates
2 parents f30c736 + f6fafbd commit dd456c1

11 files changed

Lines changed: 3573 additions & 88 deletions

File tree

ImageEditor/1.0.0/ImageEditor.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ The <strong>Image Editor</strong> allows you to select any handout that contains
8282
<li>The Image Editor cannot be used to edit its own handout.</li>
8383
<li>Only images in the <strong>notes</strong> field of a handout are visible to the editor. Images in gmnotes are not shown.</li>
8484
<li>Style changes are written directly to the handout HTML. Always keep a backup of important handout content.</li>
85+
<li><strong>Large handouts:</strong> If the referenced handout contains a very large amount of content (many images, long text), keep it <strong>closed</strong> while making edits in the Image Editor. Having both handouts open simultaneously while saving changes can cause the browser to become unresponsive.</li>
8586
</ul>
8687
`;
8788

@@ -110,6 +111,8 @@ The <strong>Image Editor</strong> allows you to select any handout that contains
110111
// ==================================================
111112
const Config = {
112113
editorName: 'Image Editor',
114+
115+
largeHandoutWarningSize: 100000,
113116

114117
properties: {
115118
width: { type: 'size' },
@@ -655,6 +658,19 @@ The <strong>Image Editor</strong> allows you to select any handout that contains
655658

656659
Utils.rebuildHandoutCache(() => {
657660
handout.get('notes', notes => {
661+
662+
if (notes && notes.length > Config.largeHandoutWarningSize) {
663+
Utils.whisper(msg.who,
664+
`<div style="${CSS.launchBox}">` +
665+
`<div style="${CSS.launchTitle}" style="color:#ffaa44;">⚠ Large Handout Warning</div>` +
666+
`<div style="color:#ccc; font-size:12px;">The chosen handout is ${Math.round(notes.length/1000)}k characters. ` +
667+
`If you keep it open while editing, your browser may become unresponsive. ` +
668+
`It is recommended to <strong>close the referenced handout</strong> before making edits, ` +
669+
`then reopen it to review changes.</div>` +
670+
`</div>`
671+
);
672+
}
673+
658674
const images = Parser.extractImages(notes);
659675
if (!images.length) {
660676
editor.set('notes',

ImageEditor/1.0.1/ImageEditor.js

Lines changed: 805 additions & 0 deletions
Large diffs are not rendered by default.

ImageEditor/ImageEditor.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ The <strong>Image Editor</strong> allows you to select any handout that contains
8282
<li>The Image Editor cannot be used to edit its own handout.</li>
8383
<li>Only images in the <strong>notes</strong> field of a handout are visible to the editor. Images in gmnotes are not shown.</li>
8484
<li>Style changes are written directly to the handout HTML. Always keep a backup of important handout content.</li>
85+
<li><strong>Large handouts:</strong> If the referenced handout contains a very large amount of content (many images, long text), keep it <strong>closed</strong> while making edits in the Image Editor. Having both handouts open simultaneously while saving changes can cause the browser to become unresponsive.</li>
8586
</ul>
8687
`;
8788

@@ -110,6 +111,8 @@ The <strong>Image Editor</strong> allows you to select any handout that contains
110111
// ==================================================
111112
const Config = {
112113
editorName: 'Image Editor',
114+
115+
largeHandoutWarningSize: 100000,
113116

114117
properties: {
115118
width: { type: 'size' },
@@ -655,6 +658,19 @@ The <strong>Image Editor</strong> allows you to select any handout that contains
655658

656659
Utils.rebuildHandoutCache(() => {
657660
handout.get('notes', notes => {
661+
662+
if (notes && notes.length > Config.largeHandoutWarningSize) {
663+
Utils.whisper(msg.who,
664+
`<div style="${CSS.launchBox}">` +
665+
`<div style="${CSS.launchTitle}" style="color:#ffaa44;">⚠ Large Handout Warning</div>` +
666+
`<div style="color:#ccc; font-size:12px;">The chosen handout is ${Math.round(notes.length/1000)}k characters. ` +
667+
`If you keep it open while editing, your browser may become unresponsive. ` +
668+
`It is recommended to <strong>close the referenced handout</strong> before making edits, ` +
669+
`then reopen it to review changes.</div>` +
670+
`</div>`
671+
);
672+
}
673+
658674
const images = Parser.extractImages(notes);
659675
if (!images.length) {
660676
editor.set('notes',

ImageEditor/script.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Image Editor",
33
"script": "ImageEditor.js",
4-
"version": "1.0.0",
4+
"version": "1.0.1",
55
"description": "Provides a graphical interface for editing images inside Roll20 handouts, including layout, styling, and attributes without manual HTML editing.",
66
"authors": "Keith Curtis",
77
"roll20userid": "162065",
@@ -10,5 +10,5 @@
1010
},
1111
"dependencies": [],
1212
"conflicts": [],
13-
"previousversions": ["1.0.0"]
14-
}
13+
"previousversions": ["1.0.0","1.0.1"]
14+
}

0 commit comments

Comments
 (0)