Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/files_markdown.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'js/editor.ts')
-rw-r--r--js/editor.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/js/editor.ts b/js/editor.ts
index b7b1204..bf302ab 100644
--- a/js/editor.ts
+++ b/js/editor.ts
@@ -1,5 +1,6 @@
import {PreviewPlugin} from "./PreviewPlugin";
import {SidebarPreview} from "./SidebarPreview";
+import {PublicPreview} from "./PublicPreview";
const previewPlugin = new PreviewPlugin();
@@ -7,6 +8,18 @@ $(document).ready(function () {
if (OCA.Files_Texteditor && OCA.Files_Texteditor.registerPreviewPlugin) {
OCA.Files_Texteditor.registerPreviewPlugin('text/markdown', previewPlugin);
}
+
+ if (
+ $('#isPublic').val() &&
+ $('#mimetype').val() === 'text/markdown'
+ ) {
+ const publicPreview = new PublicPreview();
+ const previewRoot = $('#preview');
+ previewRoot.addClass('text-markdown');
+ const previewFrame = $('<div class="public-preview"/>');
+ previewRoot.prepend(previewFrame);
+ publicPreview.attach(previewFrame, $('#sharingToken').val());
+ }
});
// coerce webpack into loading scripts properly