retold-content-system 1.0.9 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "retold-content-system",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "Retold Content System - Markdown content viewer and editor",
5
5
  "main": "source/Pict-ContentSystem-Bundle.js",
6
6
  "bin": {
@@ -117,7 +117,7 @@ class ContentEditorApplication extends libPictApplication
117
117
  // Settings
118
118
  AutoSegmentMarkdown: false,
119
119
  AutoSegmentDepth: 1,
120
- AutoContentPreview: true,
120
+ ContentPreviewMode: 'off',
121
121
  MarkdownEditingControls: true,
122
122
  MarkdownWordWrap: true,
123
123
  CodeWordWrap: false,
@@ -738,19 +738,8 @@ class ContentEditorApplication extends libPictApplication
738
738
  tmpEditorView.render();
739
739
  tmpEditorView.marshalToView();
740
740
 
741
- // Always ensure the global preview class is clear so
742
- // per-segment toggles work.
743
- tmpEditorView.togglePreview(true);
744
-
745
- // Set per-segment preview visibility based on the
746
- // Auto Content Preview setting. We must always loop
747
- // to clear any stale _hiddenPreviewSegments state
748
- // from previous file loads.
749
- let tmpShowPreviews = !!tmpSelf.pict.AppData.ContentEditor.AutoContentPreview;
750
- for (let tmpIdx in tmpEditorView._segmentEditors)
751
- {
752
- tmpEditorView.toggleSegmentPreview(parseInt(tmpIdx, 10), tmpShowPreviews);
753
- }
741
+ // Apply the Content Preview Mode setting
742
+ tmpEditorView.setPreviewMode(tmpSelf.pict.AppData.ContentEditor.ContentPreviewMode || 'off');
754
743
 
755
744
  // Apply the Editing Controls setting (line numbers
756
745
  // and right sidebar) via the library's toggleControls.
@@ -1426,7 +1415,7 @@ class ContentEditorApplication extends libPictApplication
1426
1415
  {
1427
1416
  AutoSegmentMarkdown: tmpSettings.AutoSegmentMarkdown,
1428
1417
  AutoSegmentDepth: tmpSettings.AutoSegmentDepth,
1429
- AutoContentPreview: tmpSettings.AutoContentPreview,
1418
+ ContentPreviewMode: tmpSettings.ContentPreviewMode,
1430
1419
  MarkdownEditingControls: tmpSettings.MarkdownEditingControls,
1431
1420
  MarkdownWordWrap: tmpSettings.MarkdownWordWrap,
1432
1421
  CodeWordWrap: tmpSettings.CodeWordWrap,
@@ -1479,9 +1468,14 @@ class ContentEditorApplication extends libPictApplication
1479
1468
  {
1480
1469
  tmpSettings.AutoSegmentDepth = tmpStored.AutoSegmentDepth;
1481
1470
  }
1482
- if (typeof (tmpStored.AutoContentPreview) === 'boolean')
1471
+ if (typeof (tmpStored.ContentPreviewMode) === 'string')
1472
+ {
1473
+ tmpSettings.ContentPreviewMode = tmpStored.ContentPreviewMode;
1474
+ }
1475
+ else if (typeof (tmpStored.AutoContentPreview) === 'boolean')
1483
1476
  {
1484
- tmpSettings.AutoContentPreview = tmpStored.AutoContentPreview;
1477
+ // Backward compat: migrate old boolean setting
1478
+ tmpSettings.ContentPreviewMode = tmpStored.AutoContentPreview ? 'bottom' : 'off';
1485
1479
  }
1486
1480
  if (typeof (tmpStored.MarkdownEditingControls) === 'boolean')
1487
1481
  {
@@ -274,11 +274,15 @@ const _ViewConfiguration =
274
274
  onchange="{~P~}.views['ContentEditor-SettingsPanel'].onEditingControlsChanged(this.checked)">
275
275
  </div>
276
276
  <div class="content-editor-settings-row">
277
- <label class="content-editor-settings-checkbox-label"
278
- for="ContentEditor-Setting-AutoPreview">Auto Content Preview</label>
279
- <input type="checkbox" class="content-editor-settings-checkbox"
280
- id="ContentEditor-Setting-AutoPreview"
281
- onchange="{~P~}.views['ContentEditor-SettingsPanel'].onAutoPreviewChanged(this.checked)">
277
+ <span class="content-editor-settings-select-label">Content Preview</span>
278
+ <select class="content-editor-settings-select"
279
+ id="ContentEditor-Setting-ContentPreviewMode"
280
+ onchange="{~P~}.views['ContentEditor-SettingsPanel'].onContentPreviewModeChanged(this.value)">
281
+ <option value="off">Off</option>
282
+ <option value="bottom">Underneath</option>
283
+ <option value="side">Beside</option>
284
+ <option value="tabbed">Tab</option>
285
+ </select>
282
286
  </div>
283
287
  <div class="content-editor-settings-row">
284
288
  <label class="content-editor-settings-checkbox-label"
@@ -387,10 +391,10 @@ class ContentEditorSettingsPanelView extends libPictView
387
391
  tmpControlsCheckbox[0].checked = tmpSettings.MarkdownEditingControls;
388
392
  }
389
393
 
390
- let tmpPreviewCheckbox = this.pict.ContentAssignment.getElement('#ContentEditor-Setting-AutoPreview');
391
- if (tmpPreviewCheckbox && tmpPreviewCheckbox[0])
394
+ let tmpPreviewSelect = this.pict.ContentAssignment.getElement('#ContentEditor-Setting-ContentPreviewMode');
395
+ if (tmpPreviewSelect && tmpPreviewSelect[0])
392
396
  {
393
- tmpPreviewCheckbox[0].checked = tmpSettings.AutoContentPreview;
397
+ tmpPreviewSelect[0].value = tmpSettings.ContentPreviewMode || 'off';
394
398
  }
395
399
 
396
400
  let tmpSegmentCheckbox = this.pict.ContentAssignment.getElement('#ContentEditor-Setting-AutoSegment');
@@ -535,32 +539,15 @@ class ContentEditorSettingsPanelView extends libPictView
535
539
  }
536
540
  }
537
541
 
538
- onAutoPreviewChanged(pChecked)
542
+ onContentPreviewModeChanged(pMode)
539
543
  {
540
- this.pict.AppData.ContentEditor.AutoContentPreview = pChecked;
544
+ this.pict.AppData.ContentEditor.ContentPreviewMode = pMode;
541
545
  this.pict.PictApplication.saveSettings();
542
546
 
543
547
  let tmpEditorView = this.pict.views['ContentEditor-MarkdownEditor'];
544
548
  if (tmpEditorView && this.pict.AppData.ContentEditor.ActiveEditor === 'markdown')
545
549
  {
546
- if (pChecked)
547
- {
548
- // Turning ON: clear global hidden class and show all previews
549
- tmpEditorView.togglePreview(true);
550
- for (let tmpIdx in tmpEditorView._segmentEditors)
551
- {
552
- tmpEditorView.toggleSegmentPreview(parseInt(tmpIdx, 10), true);
553
- }
554
- }
555
- else
556
- {
557
- // Turning OFF: hide each segment individually so
558
- // per-segment toggle buttons still work
559
- for (let tmpIdx in tmpEditorView._segmentEditors)
560
- {
561
- tmpEditorView.toggleSegmentPreview(parseInt(tmpIdx, 10), false);
562
- }
563
- }
550
+ tmpEditorView.setPreviewMode(pMode);
564
551
  }
565
552
  }
566
553