retold-content-system 1.0.0
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/LICENSE +21 -0
- package/README.md +107 -0
- package/build-codejar-bundle.js +29 -0
- package/build-codemirror-bundle.js +29 -0
- package/codejar-entry.js +10 -0
- package/codemirror-entry.js +16 -0
- package/content/Dogs.txt.md +2 -0
- package/content/README.md +35 -0
- package/content/_sidebar.md +3 -0
- package/content/_topbar.md +1 -0
- package/content/cover.md +12 -0
- package/content/getting-started.md +73 -0
- package/css/content-system.css +42 -0
- package/css/github.css +118 -0
- package/docs/.nojekyll +0 -0
- package/docs/README.md +24 -0
- package/docs/_sidebar.md +16 -0
- package/docs/_topbar.md +6 -0
- package/docs/cli.md +119 -0
- package/docs/cover.md +16 -0
- package/docs/css/docuserve.css +73 -0
- package/docs/editor-guide.md +137 -0
- package/docs/getting-started.md +73 -0
- package/docs/index.html +39 -0
- package/docs/keyboard-shortcuts.md +40 -0
- package/docs/retold-catalog.json +81 -0
- package/docs/retold-keyword-index.json +19 -0
- package/docs/topics.md +83 -0
- package/html/codejar-bundle.js +16 -0
- package/html/codemirror-bundle.js +29982 -0
- package/html/edit.html +25 -0
- package/html/index.html +25 -0
- package/html/preview.html +19 -0
- package/package.json +70 -0
- package/server.js +43 -0
- package/source/Pict-Application-ContentEditor-Configuration.json +15 -0
- package/source/Pict-Application-ContentEditor.js +1361 -0
- package/source/Pict-Application-ContentReader-Configuration.json +15 -0
- package/source/Pict-Application-ContentReader.js +91 -0
- package/source/Pict-ContentSystem-Bundle.js +21 -0
- package/source/cli/ContentSystem-CLI-Program.js +15 -0
- package/source/cli/ContentSystem-CLI-Run.js +3 -0
- package/source/cli/ContentSystem-Server-Setup.js +405 -0
- package/source/cli/commands/ContentSystem-Command-Serve.js +104 -0
- package/source/providers/Pict-Provider-ContentEditor.js +198 -0
- package/source/views/PictView-Editor-CodeEditor.js +271 -0
- package/source/views/PictView-Editor-Layout.js +1194 -0
- package/source/views/PictView-Editor-MarkdownEditor.js +115 -0
- package/source/views/PictView-Editor-MarkdownReference.js +801 -0
- package/source/views/PictView-Editor-SettingsPanel.js +563 -0
- package/source/views/PictView-Editor-TopBar.js +366 -0
- package/source/views/PictView-Editor-Topics.js +1025 -0
|
@@ -0,0 +1,563 @@
|
|
|
1
|
+
const libPictView = require('pict-view');
|
|
2
|
+
|
|
3
|
+
const _ViewConfiguration =
|
|
4
|
+
{
|
|
5
|
+
ViewIdentifier: "ContentEditor-SettingsPanel",
|
|
6
|
+
|
|
7
|
+
DefaultRenderable: "ContentEditor-SettingsPanel-Display",
|
|
8
|
+
DefaultDestinationAddress: "#ContentEditor-SettingsPanel-Container",
|
|
9
|
+
|
|
10
|
+
AutoRender: false,
|
|
11
|
+
|
|
12
|
+
CSS: /*css*/`
|
|
13
|
+
.content-editor-settings-wrap
|
|
14
|
+
{
|
|
15
|
+
position: relative;
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
}
|
|
19
|
+
.content-editor-settings-gear
|
|
20
|
+
{
|
|
21
|
+
background: transparent;
|
|
22
|
+
border: none;
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
padding: 6px;
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
border-radius: 4px;
|
|
29
|
+
color: #B8AFA4;
|
|
30
|
+
transition: color 0.15s;
|
|
31
|
+
}
|
|
32
|
+
.content-editor-settings-gear:hover,
|
|
33
|
+
.content-editor-settings-gear.active
|
|
34
|
+
{
|
|
35
|
+
color: #E8E0D4;
|
|
36
|
+
}
|
|
37
|
+
.content-editor-settings-gear svg
|
|
38
|
+
{
|
|
39
|
+
width: 20px;
|
|
40
|
+
height: 20px;
|
|
41
|
+
fill: currentColor;
|
|
42
|
+
}
|
|
43
|
+
/* Flyout overlay — covers viewport to catch clicks outside */
|
|
44
|
+
.content-editor-settings-overlay
|
|
45
|
+
{
|
|
46
|
+
display: none;
|
|
47
|
+
position: fixed;
|
|
48
|
+
top: 0;
|
|
49
|
+
left: 0;
|
|
50
|
+
right: 0;
|
|
51
|
+
bottom: 0;
|
|
52
|
+
z-index: 999;
|
|
53
|
+
}
|
|
54
|
+
.content-editor-settings-overlay.open
|
|
55
|
+
{
|
|
56
|
+
display: block;
|
|
57
|
+
}
|
|
58
|
+
/* Flyout panel */
|
|
59
|
+
.content-editor-settings-flyout
|
|
60
|
+
{
|
|
61
|
+
position: absolute;
|
|
62
|
+
top: 44px;
|
|
63
|
+
right: 0;
|
|
64
|
+
width: 270px;
|
|
65
|
+
background: #FFF;
|
|
66
|
+
border: 1px solid #DDD6CA;
|
|
67
|
+
border-radius: 8px;
|
|
68
|
+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
|
|
69
|
+
z-index: 1000;
|
|
70
|
+
opacity: 0;
|
|
71
|
+
transform: translateY(-4px);
|
|
72
|
+
pointer-events: none;
|
|
73
|
+
transition: opacity 0.15s ease, transform 0.15s ease;
|
|
74
|
+
}
|
|
75
|
+
.content-editor-settings-flyout.open
|
|
76
|
+
{
|
|
77
|
+
opacity: 1;
|
|
78
|
+
transform: translateY(0);
|
|
79
|
+
pointer-events: auto;
|
|
80
|
+
}
|
|
81
|
+
/* Speech bubble arrow */
|
|
82
|
+
.content-editor-settings-flyout::before
|
|
83
|
+
{
|
|
84
|
+
content: '';
|
|
85
|
+
position: absolute;
|
|
86
|
+
top: -7px;
|
|
87
|
+
right: 12px;
|
|
88
|
+
width: 12px;
|
|
89
|
+
height: 12px;
|
|
90
|
+
background: #FFF;
|
|
91
|
+
border-left: 1px solid #DDD6CA;
|
|
92
|
+
border-top: 1px solid #DDD6CA;
|
|
93
|
+
transform: rotate(45deg);
|
|
94
|
+
}
|
|
95
|
+
.content-editor-settings-flyout-body
|
|
96
|
+
{
|
|
97
|
+
padding: 8px;
|
|
98
|
+
}
|
|
99
|
+
.content-editor-settings-flyout-link
|
|
100
|
+
{
|
|
101
|
+
display: flex;
|
|
102
|
+
align-items: center;
|
|
103
|
+
gap: 8px;
|
|
104
|
+
padding: 10px 12px;
|
|
105
|
+
border-radius: 6px;
|
|
106
|
+
text-decoration: none;
|
|
107
|
+
color: #3D3229;
|
|
108
|
+
font-size: 0.85rem;
|
|
109
|
+
font-weight: 500;
|
|
110
|
+
transition: background 0.1s;
|
|
111
|
+
}
|
|
112
|
+
.content-editor-settings-flyout-link:hover
|
|
113
|
+
{
|
|
114
|
+
background: #F5F3EE;
|
|
115
|
+
}
|
|
116
|
+
.content-editor-settings-flyout-link svg
|
|
117
|
+
{
|
|
118
|
+
width: 16px;
|
|
119
|
+
height: 16px;
|
|
120
|
+
flex-shrink: 0;
|
|
121
|
+
fill: #8A7F72;
|
|
122
|
+
}
|
|
123
|
+
.content-editor-settings-divider
|
|
124
|
+
{
|
|
125
|
+
height: 1px;
|
|
126
|
+
background: #EDE9E3;
|
|
127
|
+
margin: 4px 8px;
|
|
128
|
+
}
|
|
129
|
+
/* Settings controls */
|
|
130
|
+
.content-editor-settings-section
|
|
131
|
+
{
|
|
132
|
+
padding: 8px 12px;
|
|
133
|
+
}
|
|
134
|
+
.content-editor-settings-label
|
|
135
|
+
{
|
|
136
|
+
font-size: 0.72rem;
|
|
137
|
+
font-weight: 600;
|
|
138
|
+
text-transform: uppercase;
|
|
139
|
+
letter-spacing: 0.5px;
|
|
140
|
+
color: #8A7F72;
|
|
141
|
+
margin-bottom: 8px;
|
|
142
|
+
}
|
|
143
|
+
.content-editor-settings-row
|
|
144
|
+
{
|
|
145
|
+
display: flex;
|
|
146
|
+
align-items: center;
|
|
147
|
+
justify-content: space-between;
|
|
148
|
+
gap: 8px;
|
|
149
|
+
margin-bottom: 6px;
|
|
150
|
+
}
|
|
151
|
+
.content-editor-settings-row:last-child
|
|
152
|
+
{
|
|
153
|
+
margin-bottom: 0;
|
|
154
|
+
}
|
|
155
|
+
.content-editor-settings-checkbox
|
|
156
|
+
{
|
|
157
|
+
width: 16px;
|
|
158
|
+
height: 16px;
|
|
159
|
+
accent-color: #2E7D74;
|
|
160
|
+
cursor: pointer;
|
|
161
|
+
flex-shrink: 0;
|
|
162
|
+
}
|
|
163
|
+
.content-editor-settings-checkbox-label
|
|
164
|
+
{
|
|
165
|
+
font: inherit;
|
|
166
|
+
font-size: 0.85rem;
|
|
167
|
+
color: #3D3229;
|
|
168
|
+
cursor: pointer;
|
|
169
|
+
user-select: none;
|
|
170
|
+
}
|
|
171
|
+
.content-editor-settings-select
|
|
172
|
+
{
|
|
173
|
+
width: 140px;
|
|
174
|
+
padding: 5px 8px;
|
|
175
|
+
border: 1px solid #DDD6CA;
|
|
176
|
+
border-radius: 4px;
|
|
177
|
+
background: #FFF;
|
|
178
|
+
font-size: 0.82rem;
|
|
179
|
+
color: #3D3229;
|
|
180
|
+
cursor: pointer;
|
|
181
|
+
}
|
|
182
|
+
.content-editor-settings-select:disabled
|
|
183
|
+
{
|
|
184
|
+
opacity: 0.45;
|
|
185
|
+
cursor: not-allowed;
|
|
186
|
+
}
|
|
187
|
+
.content-editor-settings-select-label
|
|
188
|
+
{
|
|
189
|
+
font-size: 0.82rem;
|
|
190
|
+
color: #5E5549;
|
|
191
|
+
white-space: nowrap;
|
|
192
|
+
}
|
|
193
|
+
`,
|
|
194
|
+
|
|
195
|
+
Templates:
|
|
196
|
+
[
|
|
197
|
+
{
|
|
198
|
+
Hash: "ContentEditor-SettingsPanel-Template",
|
|
199
|
+
Template: /*html*/`
|
|
200
|
+
<div class="content-editor-settings-wrap">
|
|
201
|
+
<button class="content-editor-settings-gear" id="ContentEditor-SettingsGear"
|
|
202
|
+
onclick="{~P~}.views['ContentEditor-SettingsPanel'].togglePanel()">
|
|
203
|
+
<svg viewBox="0 0 24 24"><path d="M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58a.49.49 0 0 0 .12-.61l-1.92-3.32a.49.49 0 0 0-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54a.48.48 0 0 0-.48-.41h-3.84a.48.48 0 0 0-.48.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96a.49.49 0 0 0-.59.22L2.74 8.87a.48.48 0 0 0 .12.61l2.03 1.58c-.05.3-.07.62-.07.94s.02.64.07.94l-2.03 1.58a.49.49 0 0 0-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.26.41.48.41h3.84c.24 0 .44-.17.48-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6A3.6 3.6 0 1 1 12 8.4a3.6 3.6 0 0 1 0 7.2z"/></svg>
|
|
204
|
+
</button>
|
|
205
|
+
<div class="content-editor-settings-overlay" id="ContentEditor-SettingsOverlay"
|
|
206
|
+
onclick="{~P~}.views['ContentEditor-SettingsPanel'].closePanel()"></div>
|
|
207
|
+
<div class="content-editor-settings-flyout" id="ContentEditor-SettingsFlyout">
|
|
208
|
+
<div class="content-editor-settings-flyout-body">
|
|
209
|
+
<a class="content-editor-settings-flyout-link"
|
|
210
|
+
href="/preview.html{~D:AppData.ContentEditor.ViewerHash~}" target="_blank">
|
|
211
|
+
<svg viewBox="0 0 24 24"><path d="M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"/></svg>
|
|
212
|
+
Docuserve Preview
|
|
213
|
+
</a>
|
|
214
|
+
<div class="content-editor-settings-divider"></div>
|
|
215
|
+
<div class="content-editor-settings-section">
|
|
216
|
+
<div class="content-editor-settings-label">Word Wrap</div>
|
|
217
|
+
<div class="content-editor-settings-row">
|
|
218
|
+
<label class="content-editor-settings-checkbox-label"
|
|
219
|
+
for="ContentEditor-Setting-MarkdownWordWrap">Markdown Word Wrap</label>
|
|
220
|
+
<input type="checkbox" class="content-editor-settings-checkbox"
|
|
221
|
+
id="ContentEditor-Setting-MarkdownWordWrap"
|
|
222
|
+
onchange="{~P~}.views['ContentEditor-SettingsPanel'].onMarkdownWordWrapChanged(this.checked)">
|
|
223
|
+
</div>
|
|
224
|
+
<div class="content-editor-settings-row">
|
|
225
|
+
<label class="content-editor-settings-checkbox-label"
|
|
226
|
+
for="ContentEditor-Setting-CodeWordWrap">Code Word Wrap</label>
|
|
227
|
+
<input type="checkbox" class="content-editor-settings-checkbox"
|
|
228
|
+
id="ContentEditor-Setting-CodeWordWrap"
|
|
229
|
+
onchange="{~P~}.views['ContentEditor-SettingsPanel'].onCodeWordWrapChanged(this.checked)">
|
|
230
|
+
</div>
|
|
231
|
+
</div>
|
|
232
|
+
<div class="content-editor-settings-divider"></div>
|
|
233
|
+
<div class="content-editor-settings-section">
|
|
234
|
+
<div class="content-editor-settings-label">Markdown Editor</div>
|
|
235
|
+
<div class="content-editor-settings-row">
|
|
236
|
+
<label class="content-editor-settings-checkbox-label"
|
|
237
|
+
for="ContentEditor-Setting-EditingControls">Editing Controls</label>
|
|
238
|
+
<input type="checkbox" class="content-editor-settings-checkbox"
|
|
239
|
+
id="ContentEditor-Setting-EditingControls"
|
|
240
|
+
onchange="{~P~}.views['ContentEditor-SettingsPanel'].onEditingControlsChanged(this.checked)">
|
|
241
|
+
</div>
|
|
242
|
+
<div class="content-editor-settings-row">
|
|
243
|
+
<label class="content-editor-settings-checkbox-label"
|
|
244
|
+
for="ContentEditor-Setting-AutoPreview">Auto Content Preview</label>
|
|
245
|
+
<input type="checkbox" class="content-editor-settings-checkbox"
|
|
246
|
+
id="ContentEditor-Setting-AutoPreview"
|
|
247
|
+
onchange="{~P~}.views['ContentEditor-SettingsPanel'].onAutoPreviewChanged(this.checked)">
|
|
248
|
+
</div>
|
|
249
|
+
<div class="content-editor-settings-row">
|
|
250
|
+
<label class="content-editor-settings-checkbox-label"
|
|
251
|
+
for="ContentEditor-Setting-AutoSegment">Auto Segment Markdown</label>
|
|
252
|
+
<input type="checkbox" class="content-editor-settings-checkbox"
|
|
253
|
+
id="ContentEditor-Setting-AutoSegment"
|
|
254
|
+
onchange="{~P~}.views['ContentEditor-SettingsPanel'].onAutoSegmentChanged(this.checked)">
|
|
255
|
+
</div>
|
|
256
|
+
<div class="content-editor-settings-row">
|
|
257
|
+
<span class="content-editor-settings-select-label">Segment Depth</span>
|
|
258
|
+
<select class="content-editor-settings-select"
|
|
259
|
+
id="ContentEditor-Setting-SegmentDepth"
|
|
260
|
+
disabled
|
|
261
|
+
onchange="{~P~}.views['ContentEditor-SettingsPanel'].onSegmentDepthChanged(this.value)">
|
|
262
|
+
<option value="1">Depth 1: Blocks</option>
|
|
263
|
+
<option value="2">Depth 2: ##</option>
|
|
264
|
+
<option value="3">Depth 3: ###</option>
|
|
265
|
+
<option value="4">Depth 4: ####</option>
|
|
266
|
+
<option value="5">Depth 5: #####</option>
|
|
267
|
+
<option value="6">Depth 6: ######</option>
|
|
268
|
+
</select>
|
|
269
|
+
</div>
|
|
270
|
+
</div>
|
|
271
|
+
<div class="content-editor-settings-divider"></div>
|
|
272
|
+
<div class="content-editor-settings-section">
|
|
273
|
+
<div class="content-editor-settings-label">Media Preview</div>
|
|
274
|
+
<div class="content-editor-settings-row">
|
|
275
|
+
<label class="content-editor-settings-checkbox-label"
|
|
276
|
+
for="ContentEditor-Setting-AutoPreviewImages">Auto-Preview Images</label>
|
|
277
|
+
<input type="checkbox" class="content-editor-settings-checkbox"
|
|
278
|
+
id="ContentEditor-Setting-AutoPreviewImages"
|
|
279
|
+
onchange="{~P~}.views['ContentEditor-SettingsPanel'].onAutoPreviewImagesChanged(this.checked)">
|
|
280
|
+
</div>
|
|
281
|
+
<div class="content-editor-settings-row">
|
|
282
|
+
<label class="content-editor-settings-checkbox-label"
|
|
283
|
+
for="ContentEditor-Setting-AutoPreviewVideo">Auto-Preview Video</label>
|
|
284
|
+
<input type="checkbox" class="content-editor-settings-checkbox"
|
|
285
|
+
id="ContentEditor-Setting-AutoPreviewVideo"
|
|
286
|
+
onchange="{~P~}.views['ContentEditor-SettingsPanel'].onAutoPreviewVideoChanged(this.checked)">
|
|
287
|
+
</div>
|
|
288
|
+
<div class="content-editor-settings-row">
|
|
289
|
+
<label class="content-editor-settings-checkbox-label"
|
|
290
|
+
for="ContentEditor-Setting-AutoPreviewAudio">Auto-Preview Audio</label>
|
|
291
|
+
<input type="checkbox" class="content-editor-settings-checkbox"
|
|
292
|
+
id="ContentEditor-Setting-AutoPreviewAudio"
|
|
293
|
+
onchange="{~P~}.views['ContentEditor-SettingsPanel'].onAutoPreviewAudioChanged(this.checked)">
|
|
294
|
+
</div>
|
|
295
|
+
</div>
|
|
296
|
+
<div class="content-editor-settings-divider"></div>
|
|
297
|
+
<div class="content-editor-settings-section">
|
|
298
|
+
<div class="content-editor-settings-label">File Browser</div>
|
|
299
|
+
<div class="content-editor-settings-row">
|
|
300
|
+
<label class="content-editor-settings-checkbox-label"
|
|
301
|
+
for="ContentEditor-Setting-ShowHiddenFiles">Show Hidden Files</label>
|
|
302
|
+
<input type="checkbox" class="content-editor-settings-checkbox"
|
|
303
|
+
id="ContentEditor-Setting-ShowHiddenFiles"
|
|
304
|
+
onchange="{~P~}.views['ContentEditor-SettingsPanel'].onShowHiddenFilesChanged(this.checked)">
|
|
305
|
+
</div>
|
|
306
|
+
</div>
|
|
307
|
+
</div>
|
|
308
|
+
</div>
|
|
309
|
+
</div>
|
|
310
|
+
`
|
|
311
|
+
}
|
|
312
|
+
],
|
|
313
|
+
|
|
314
|
+
Renderables:
|
|
315
|
+
[
|
|
316
|
+
{
|
|
317
|
+
RenderableHash: "ContentEditor-SettingsPanel-Display",
|
|
318
|
+
TemplateHash: "ContentEditor-SettingsPanel-Template",
|
|
319
|
+
DestinationAddress: "#ContentEditor-SettingsPanel-Container",
|
|
320
|
+
RenderMethod: "replace"
|
|
321
|
+
}
|
|
322
|
+
]
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
class ContentEditorSettingsPanelView extends libPictView
|
|
326
|
+
{
|
|
327
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
328
|
+
{
|
|
329
|
+
super(pFable, pOptions, pServiceHash);
|
|
330
|
+
this._isOpen = false;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
onAfterRender(pRenderable, pRenderDestinationAddress, pRecord, pContent)
|
|
334
|
+
{
|
|
335
|
+
// Sync the UI controls with current state
|
|
336
|
+
let tmpSettings = this.pict.AppData.ContentEditor;
|
|
337
|
+
|
|
338
|
+
let tmpMdWrapCheckbox = this.pict.ContentAssignment.getElement('#ContentEditor-Setting-MarkdownWordWrap');
|
|
339
|
+
if (tmpMdWrapCheckbox && tmpMdWrapCheckbox[0])
|
|
340
|
+
{
|
|
341
|
+
tmpMdWrapCheckbox[0].checked = tmpSettings.MarkdownWordWrap;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
let tmpCodeWrapCheckbox = this.pict.ContentAssignment.getElement('#ContentEditor-Setting-CodeWordWrap');
|
|
345
|
+
if (tmpCodeWrapCheckbox && tmpCodeWrapCheckbox[0])
|
|
346
|
+
{
|
|
347
|
+
tmpCodeWrapCheckbox[0].checked = tmpSettings.CodeWordWrap;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
let tmpControlsCheckbox = this.pict.ContentAssignment.getElement('#ContentEditor-Setting-EditingControls');
|
|
351
|
+
if (tmpControlsCheckbox && tmpControlsCheckbox[0])
|
|
352
|
+
{
|
|
353
|
+
tmpControlsCheckbox[0].checked = tmpSettings.MarkdownEditingControls;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
let tmpPreviewCheckbox = this.pict.ContentAssignment.getElement('#ContentEditor-Setting-AutoPreview');
|
|
357
|
+
if (tmpPreviewCheckbox && tmpPreviewCheckbox[0])
|
|
358
|
+
{
|
|
359
|
+
tmpPreviewCheckbox[0].checked = tmpSettings.AutoContentPreview;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
let tmpSegmentCheckbox = this.pict.ContentAssignment.getElement('#ContentEditor-Setting-AutoSegment');
|
|
363
|
+
if (tmpSegmentCheckbox && tmpSegmentCheckbox[0])
|
|
364
|
+
{
|
|
365
|
+
tmpSegmentCheckbox[0].checked = tmpSettings.AutoSegmentMarkdown;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
let tmpSelect = this.pict.ContentAssignment.getElement('#ContentEditor-Setting-SegmentDepth');
|
|
369
|
+
if (tmpSelect && tmpSelect[0])
|
|
370
|
+
{
|
|
371
|
+
tmpSelect[0].value = String(tmpSettings.AutoSegmentDepth);
|
|
372
|
+
tmpSelect[0].disabled = !tmpSettings.AutoSegmentMarkdown;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
let tmpImgCheckbox = this.pict.ContentAssignment.getElement('#ContentEditor-Setting-AutoPreviewImages');
|
|
376
|
+
if (tmpImgCheckbox && tmpImgCheckbox[0])
|
|
377
|
+
{
|
|
378
|
+
tmpImgCheckbox[0].checked = tmpSettings.AutoPreviewImages;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
let tmpVideoCheckbox = this.pict.ContentAssignment.getElement('#ContentEditor-Setting-AutoPreviewVideo');
|
|
382
|
+
if (tmpVideoCheckbox && tmpVideoCheckbox[0])
|
|
383
|
+
{
|
|
384
|
+
tmpVideoCheckbox[0].checked = tmpSettings.AutoPreviewVideo;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
let tmpAudioCheckbox = this.pict.ContentAssignment.getElement('#ContentEditor-Setting-AutoPreviewAudio');
|
|
388
|
+
if (tmpAudioCheckbox && tmpAudioCheckbox[0])
|
|
389
|
+
{
|
|
390
|
+
tmpAudioCheckbox[0].checked = tmpSettings.AutoPreviewAudio;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
let tmpHiddenCheckbox = this.pict.ContentAssignment.getElement('#ContentEditor-Setting-ShowHiddenFiles');
|
|
394
|
+
if (tmpHiddenCheckbox && tmpHiddenCheckbox[0])
|
|
395
|
+
{
|
|
396
|
+
tmpHiddenCheckbox[0].checked = tmpSettings.ShowHiddenFiles;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
return super.onAfterRender(pRenderable, pRenderDestinationAddress, pRecord, pContent);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
togglePanel()
|
|
403
|
+
{
|
|
404
|
+
if (this._isOpen)
|
|
405
|
+
{
|
|
406
|
+
this.closePanel();
|
|
407
|
+
}
|
|
408
|
+
else
|
|
409
|
+
{
|
|
410
|
+
this.openPanel();
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
openPanel()
|
|
415
|
+
{
|
|
416
|
+
this._isOpen = true;
|
|
417
|
+
|
|
418
|
+
let tmpFlyout = this.pict.ContentAssignment.getElement('#ContentEditor-SettingsFlyout');
|
|
419
|
+
let tmpOverlay = this.pict.ContentAssignment.getElement('#ContentEditor-SettingsOverlay');
|
|
420
|
+
let tmpGear = this.pict.ContentAssignment.getElement('#ContentEditor-SettingsGear');
|
|
421
|
+
|
|
422
|
+
if (tmpFlyout && tmpFlyout[0]) tmpFlyout[0].classList.add('open');
|
|
423
|
+
if (tmpOverlay && tmpOverlay[0]) tmpOverlay[0].classList.add('open');
|
|
424
|
+
if (tmpGear && tmpGear[0]) tmpGear[0].classList.add('active');
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
closePanel()
|
|
428
|
+
{
|
|
429
|
+
this._isOpen = false;
|
|
430
|
+
|
|
431
|
+
let tmpFlyout = this.pict.ContentAssignment.getElement('#ContentEditor-SettingsFlyout');
|
|
432
|
+
let tmpOverlay = this.pict.ContentAssignment.getElement('#ContentEditor-SettingsOverlay');
|
|
433
|
+
let tmpGear = this.pict.ContentAssignment.getElement('#ContentEditor-SettingsGear');
|
|
434
|
+
|
|
435
|
+
if (tmpFlyout && tmpFlyout[0]) tmpFlyout[0].classList.remove('open');
|
|
436
|
+
if (tmpOverlay && tmpOverlay[0]) tmpOverlay[0].classList.remove('open');
|
|
437
|
+
if (tmpGear && tmpGear[0]) tmpGear[0].classList.remove('active');
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
onMarkdownWordWrapChanged(pChecked)
|
|
441
|
+
{
|
|
442
|
+
this.pict.AppData.ContentEditor.MarkdownWordWrap = pChecked;
|
|
443
|
+
this.pict.PictApplication.saveSettings();
|
|
444
|
+
|
|
445
|
+
// Live-apply to all CodeMirror segment editors if markdown is active
|
|
446
|
+
let tmpEditorView = this.pict.views['ContentEditor-MarkdownEditor'];
|
|
447
|
+
if (tmpEditorView && this.pict.AppData.ContentEditor.ActiveEditor === 'markdown'
|
|
448
|
+
&& tmpEditorView._segmentEditors)
|
|
449
|
+
{
|
|
450
|
+
for (let tmpKey in tmpEditorView._segmentEditors)
|
|
451
|
+
{
|
|
452
|
+
let tmpEditor = tmpEditorView._segmentEditors[tmpKey];
|
|
453
|
+
if (tmpEditor && tmpEditor.contentDOM)
|
|
454
|
+
{
|
|
455
|
+
if (pChecked)
|
|
456
|
+
{
|
|
457
|
+
tmpEditor.contentDOM.classList.add('cm-lineWrapping');
|
|
458
|
+
}
|
|
459
|
+
else
|
|
460
|
+
{
|
|
461
|
+
tmpEditor.contentDOM.classList.remove('cm-lineWrapping');
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
onCodeWordWrapChanged(pChecked)
|
|
469
|
+
{
|
|
470
|
+
this.pict.AppData.ContentEditor.CodeWordWrap = pChecked;
|
|
471
|
+
this.pict.PictApplication.saveSettings();
|
|
472
|
+
|
|
473
|
+
// Live-apply to the code editor if it's currently active
|
|
474
|
+
let tmpCodeEditorView = this.pict.views['ContentEditor-CodeEditor'];
|
|
475
|
+
if (tmpCodeEditorView && tmpCodeEditorView._editorElement
|
|
476
|
+
&& this.pict.AppData.ContentEditor.ActiveEditor === 'code')
|
|
477
|
+
{
|
|
478
|
+
if (pChecked)
|
|
479
|
+
{
|
|
480
|
+
tmpCodeEditorView._editorElement.style.whiteSpace = 'pre-wrap';
|
|
481
|
+
tmpCodeEditorView._editorElement.style.overflowWrap = 'break-word';
|
|
482
|
+
}
|
|
483
|
+
else
|
|
484
|
+
{
|
|
485
|
+
tmpCodeEditorView._editorElement.style.whiteSpace = 'pre';
|
|
486
|
+
tmpCodeEditorView._editorElement.style.overflowWrap = 'normal';
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
onEditingControlsChanged(pChecked)
|
|
492
|
+
{
|
|
493
|
+
this.pict.AppData.ContentEditor.MarkdownEditingControls = pChecked;
|
|
494
|
+
this.pict.PictApplication.saveSettings();
|
|
495
|
+
|
|
496
|
+
// Live-apply to the markdown editor if it's currently active
|
|
497
|
+
let tmpEditorView = this.pict.views['ContentEditor-MarkdownEditor'];
|
|
498
|
+
if (tmpEditorView && this.pict.AppData.ContentEditor.ActiveEditor === 'markdown')
|
|
499
|
+
{
|
|
500
|
+
tmpEditorView.toggleControls(pChecked);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
onAutoPreviewChanged(pChecked)
|
|
505
|
+
{
|
|
506
|
+
this.pict.AppData.ContentEditor.AutoContentPreview = pChecked;
|
|
507
|
+
this.pict.PictApplication.saveSettings();
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
onAutoSegmentChanged(pChecked)
|
|
511
|
+
{
|
|
512
|
+
this.pict.AppData.ContentEditor.AutoSegmentMarkdown = pChecked;
|
|
513
|
+
this.pict.PictApplication.saveSettings();
|
|
514
|
+
|
|
515
|
+
// Enable/disable the depth dropdown
|
|
516
|
+
let tmpSelect = this.pict.ContentAssignment.getElement('#ContentEditor-Setting-SegmentDepth');
|
|
517
|
+
if (tmpSelect && tmpSelect[0])
|
|
518
|
+
{
|
|
519
|
+
tmpSelect[0].disabled = !pChecked;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
onSegmentDepthChanged(pValue)
|
|
524
|
+
{
|
|
525
|
+
this.pict.AppData.ContentEditor.AutoSegmentDepth = parseInt(pValue, 10) || 1;
|
|
526
|
+
this.pict.PictApplication.saveSettings();
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
onAutoPreviewImagesChanged(pChecked)
|
|
530
|
+
{
|
|
531
|
+
this.pict.AppData.ContentEditor.AutoPreviewImages = pChecked;
|
|
532
|
+
this.pict.PictApplication.saveSettings();
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
onAutoPreviewVideoChanged(pChecked)
|
|
536
|
+
{
|
|
537
|
+
this.pict.AppData.ContentEditor.AutoPreviewVideo = pChecked;
|
|
538
|
+
this.pict.PictApplication.saveSettings();
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
onAutoPreviewAudioChanged(pChecked)
|
|
542
|
+
{
|
|
543
|
+
this.pict.AppData.ContentEditor.AutoPreviewAudio = pChecked;
|
|
544
|
+
this.pict.PictApplication.saveSettings();
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
onShowHiddenFilesChanged(pChecked)
|
|
548
|
+
{
|
|
549
|
+
this.pict.AppData.ContentEditor.ShowHiddenFiles = pChecked;
|
|
550
|
+
this.pict.PictApplication.saveSettings();
|
|
551
|
+
|
|
552
|
+
// Tell the server to include/exclude hidden files, then refresh
|
|
553
|
+
let tmpSelf = this;
|
|
554
|
+
this.pict.PictApplication.syncHiddenFilesSetting(() =>
|
|
555
|
+
{
|
|
556
|
+
tmpSelf.pict.PictApplication.loadFileList();
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
module.exports = ContentEditorSettingsPanelView;
|
|
562
|
+
|
|
563
|
+
module.exports.default_configuration = _ViewConfiguration;
|