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.
Files changed (52) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +107 -0
  3. package/build-codejar-bundle.js +29 -0
  4. package/build-codemirror-bundle.js +29 -0
  5. package/codejar-entry.js +10 -0
  6. package/codemirror-entry.js +16 -0
  7. package/content/Dogs.txt.md +2 -0
  8. package/content/README.md +35 -0
  9. package/content/_sidebar.md +3 -0
  10. package/content/_topbar.md +1 -0
  11. package/content/cover.md +12 -0
  12. package/content/getting-started.md +73 -0
  13. package/css/content-system.css +42 -0
  14. package/css/github.css +118 -0
  15. package/docs/.nojekyll +0 -0
  16. package/docs/README.md +24 -0
  17. package/docs/_sidebar.md +16 -0
  18. package/docs/_topbar.md +6 -0
  19. package/docs/cli.md +119 -0
  20. package/docs/cover.md +16 -0
  21. package/docs/css/docuserve.css +73 -0
  22. package/docs/editor-guide.md +137 -0
  23. package/docs/getting-started.md +73 -0
  24. package/docs/index.html +39 -0
  25. package/docs/keyboard-shortcuts.md +40 -0
  26. package/docs/retold-catalog.json +81 -0
  27. package/docs/retold-keyword-index.json +19 -0
  28. package/docs/topics.md +83 -0
  29. package/html/codejar-bundle.js +16 -0
  30. package/html/codemirror-bundle.js +29982 -0
  31. package/html/edit.html +25 -0
  32. package/html/index.html +25 -0
  33. package/html/preview.html +19 -0
  34. package/package.json +70 -0
  35. package/server.js +43 -0
  36. package/source/Pict-Application-ContentEditor-Configuration.json +15 -0
  37. package/source/Pict-Application-ContentEditor.js +1361 -0
  38. package/source/Pict-Application-ContentReader-Configuration.json +15 -0
  39. package/source/Pict-Application-ContentReader.js +91 -0
  40. package/source/Pict-ContentSystem-Bundle.js +21 -0
  41. package/source/cli/ContentSystem-CLI-Program.js +15 -0
  42. package/source/cli/ContentSystem-CLI-Run.js +3 -0
  43. package/source/cli/ContentSystem-Server-Setup.js +405 -0
  44. package/source/cli/commands/ContentSystem-Command-Serve.js +104 -0
  45. package/source/providers/Pict-Provider-ContentEditor.js +198 -0
  46. package/source/views/PictView-Editor-CodeEditor.js +271 -0
  47. package/source/views/PictView-Editor-Layout.js +1194 -0
  48. package/source/views/PictView-Editor-MarkdownEditor.js +115 -0
  49. package/source/views/PictView-Editor-MarkdownReference.js +801 -0
  50. package/source/views/PictView-Editor-SettingsPanel.js +563 -0
  51. package/source/views/PictView-Editor-TopBar.js +366 -0
  52. 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;