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,115 @@
|
|
|
1
|
+
const libPictSectionMarkdownEditor = require('pict-section-markdowneditor');
|
|
2
|
+
|
|
3
|
+
const _ViewConfiguration =
|
|
4
|
+
{
|
|
5
|
+
ViewIdentifier: "ContentEditor-MarkdownEditor",
|
|
6
|
+
|
|
7
|
+
DefaultRenderable: "MarkdownEditor-Wrap",
|
|
8
|
+
DefaultDestinationAddress: "#ContentEditor-Editor-Container",
|
|
9
|
+
|
|
10
|
+
TargetElementAddress: "#ContentEditor-Editor-Container",
|
|
11
|
+
ContentDataAddress: "AppData.ContentEditor.Document.Segments",
|
|
12
|
+
|
|
13
|
+
ReadOnly: false,
|
|
14
|
+
EnableRichPreview: true,
|
|
15
|
+
|
|
16
|
+
AutoRender: false,
|
|
17
|
+
|
|
18
|
+
Renderables:
|
|
19
|
+
[
|
|
20
|
+
{
|
|
21
|
+
RenderableHash: "MarkdownEditor-Wrap",
|
|
22
|
+
TemplateHash: "MarkdownEditor-Container",
|
|
23
|
+
DestinationAddress: "#ContentEditor-Editor-Container"
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Content Editor Markdown Editor View
|
|
30
|
+
*
|
|
31
|
+
* Extends pict-section-markdowneditor to integrate with the
|
|
32
|
+
* content system's server-side image upload and auto-save.
|
|
33
|
+
*/
|
|
34
|
+
class ContentEditorMarkdownEditorView extends libPictSectionMarkdownEditor
|
|
35
|
+
{
|
|
36
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
37
|
+
{
|
|
38
|
+
super(pFable, pOptions, pServiceHash);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Handle image uploads — POST to the server instead of using base64.
|
|
43
|
+
*
|
|
44
|
+
* @param {File} pFile - The image file
|
|
45
|
+
* @param {number} pSegmentIndex - The segment index
|
|
46
|
+
* @param {Function} fCallback - Callback (error, url)
|
|
47
|
+
* @returns {boolean} true to indicate async handling
|
|
48
|
+
*/
|
|
49
|
+
onImageUpload(pFile, pSegmentIndex, fCallback)
|
|
50
|
+
{
|
|
51
|
+
let tmpProvider = this.pict.providers['ContentEditor-Provider'];
|
|
52
|
+
|
|
53
|
+
if (!tmpProvider)
|
|
54
|
+
{
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
tmpProvider.uploadImage(pFile, (pError, pURL) =>
|
|
59
|
+
{
|
|
60
|
+
if (pError)
|
|
61
|
+
{
|
|
62
|
+
fCallback(pError);
|
|
63
|
+
}
|
|
64
|
+
else
|
|
65
|
+
{
|
|
66
|
+
fCallback(null, pURL);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Hook to add/remove CodeMirror extensions before editor creation.
|
|
75
|
+
*
|
|
76
|
+
* Adds EditorView.lineWrapping when the Markdown Word Wrap setting
|
|
77
|
+
* is enabled.
|
|
78
|
+
*
|
|
79
|
+
* @param {Array} pExtensions - The extensions array
|
|
80
|
+
* @param {number} pSegmentIndex - The segment index
|
|
81
|
+
* @returns {Array} The modified extensions array
|
|
82
|
+
*/
|
|
83
|
+
customConfigureExtensions(pExtensions, pSegmentIndex)
|
|
84
|
+
{
|
|
85
|
+
if (this.pict.AppData.ContentEditor && this.pict.AppData.ContentEditor.MarkdownWordWrap)
|
|
86
|
+
{
|
|
87
|
+
let tmpCM = this._codeMirrorModules;
|
|
88
|
+
if (tmpCM && tmpCM.EditorView && tmpCM.EditorView.lineWrapping)
|
|
89
|
+
{
|
|
90
|
+
pExtensions.push(tmpCM.EditorView.lineWrapping);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return pExtensions;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Handle content changes — mark document as dirty.
|
|
99
|
+
*
|
|
100
|
+
* @param {number} pSegmentIndex - The segment index that changed
|
|
101
|
+
* @param {string} pContent - The new content
|
|
102
|
+
*/
|
|
103
|
+
onContentChange(pSegmentIndex, pContent)
|
|
104
|
+
{
|
|
105
|
+
if (this.pict.PictApplication)
|
|
106
|
+
{
|
|
107
|
+
this.pict.PictApplication.markDirty();
|
|
108
|
+
this.pict.PictApplication.updateStats();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
module.exports = ContentEditorMarkdownEditorView;
|
|
114
|
+
|
|
115
|
+
module.exports.default_configuration = _ViewConfiguration;
|