Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging

pull/1/head
ansuz 7 years ago
commit 97d56303bc

@ -173,6 +173,7 @@
.cp-markdown-toolbar { .cp-markdown-toolbar {
height: @toolbar_line-height; height: @toolbar_line-height;
background-color: lighten(@bg-color, 20%); background-color: lighten(@bg-color, 20%);
display: none;
button { button {
outline: 0; outline: 0;
color: @color; color: @color;

@ -144,13 +144,14 @@ define([
} }
}); });
markdownTb.setState(true); markdownTb.setState(true);
return;
} }
$editorContainer.removeClass('cp-app-code-present'); $editorContainer.removeClass('cp-app-code-present');
$previewButton.hide(); $previewButton.hide();
$previewContainer.hide(); $previewContainer.hide();
$previewButton.removeClass('active'); $previewButton.removeClass('active');
$codeMirrorContainer.addClass('cp-app-code-fullpage'); $codeMirrorContainer.addClass('cp-app-code-fullpage');
markdownTb.setState(true); markdownTb.setState(false);
}; };
var isVisible = function () { var isVisible = function () {

@ -374,10 +374,13 @@ define([
if (e) { return void console.error(e); } if (e) { return void console.error(e); }
}); });
}; };
var $toolbarButton = common.createButton('toggle', true, cfg, onClick); var $toolbarButton = common.createButton('toggle', true, cfg, onClick);
var tbState = true;
common.getAttribute(['general', 'markdown-help'], function (e, data) { common.getAttribute(['general', 'markdown-help'], function (e, data) {
if (e) { return void console.error(e); } if (e) { return void console.error(e); }
if (data === true && $toolbarButton) { if (data === true && $toolbarButton.length && tbState) {
console.log($toolbar.is(':visible'));
$toolbarButton.click(); $toolbarButton.click();
} }
}); });
@ -385,6 +388,7 @@ define([
// setState provides the ability to disable the toolbar and the button in case we don't // setState provides the ability to disable the toolbar and the button in case we don't
// have the markdown editor available (in code we can switch mode, in poll we can publish) // have the markdown editor available (in code we can switch mode, in poll we can publish)
var setState = function (state) { var setState = function (state) {
tbState = state;
if (!state) { if (!state) {
$toolbar.hide(); $toolbar.hide();
$toolbarButton.hide(); $toolbarButton.hide();
@ -411,6 +415,7 @@ define([
setState: setState setState: setState
}; };
}; };
// Avatars // Avatars
// Enable mediatags // Enable mediatags

@ -253,6 +253,7 @@ define([
newContent = normalize(newContent); newContent = normalize(newContent);
contentUpdate(newContent); contentUpdate(newContent);
} else { } else {
console.log('updating title');
title.updateTitle(title.defaultTitle); title.updateTitle(title.defaultTitle);
evOnDefaultContentNeeded.fire(); evOnDefaultContentNeeded.fire();
} }

@ -139,6 +139,11 @@ table#cp-app-poll-table {
width: auto; width: auto;
display: inline-block; display: inline-block;
} }
.cp-markdown-toolbar {
margin: auto;
min-width: 80%;
width: 80%;
}
#cp-app-poll-description { #cp-app-poll-description {
&~ .CodeMirror { &~ .CodeMirror {
margin: auto; margin: auto;

@ -258,6 +258,7 @@ define([
}; };
var setTablePublished = function (bool) { var setTablePublished = function (bool) {
if (APP.markdownTb) { APP.markdownTb.setState(!bool); }
if (bool) { if (bool) {
if (APP.$publish) { APP.$publish.hide(); } if (APP.$publish) { APP.$publish.hide(); }
if (APP.$admin) { APP.$admin.show(); } if (APP.$admin) { APP.$admin.show(); }
@ -993,6 +994,10 @@ define([
updateDescription(null, APP.proxy.description || ''); updateDescription(null, APP.proxy.description || '');
initThumbnails(); initThumbnails();
var markdownTb = APP.markdownTb = common.createMarkdownToolbar(APP.editor);
$('.CodeMirror').parent().prepend(markdownTb.toolbar);
APP.toolbar.$rightside.append(markdownTb.button);
// Initialize author name for comments. // Initialize author name for comments.
// Disable name modification for logged in users // Disable name modification for logged in users
var $cName = APP.$addComment.find('.cp-app-poll-comments-add-name') var $cName = APP.$addComment.find('.cp-app-poll-comments-add-name')

@ -33,9 +33,21 @@ h4 { font-size: 31px; }
h5 { font-size: 27px; } h5 { font-size: 27px; }
h6 { font-size: 24px; } h6 { font-size: 24px; }
.CodeMirror { #cp-app-slide-editor-container {
display: inline-flex;
flex-flow: column;
height: 100%; height: 100%;
min-height: 100%; min-height: 100%;
width: 50%;
min-width: 20%;
max-width: 80%;
overflow: hidden;
max-width: 100%;
flex: 1;
}
.CodeMirror {
flex: 1;
width: 100%;
font-size: initial; font-size: initial;
} }
.CodeMirror-focused .cm-matchhighlight { .CodeMirror-focused .cm-matchhighlight {

@ -12,7 +12,9 @@
<body class="cp-app-slide"> <body class="cp-app-slide">
<div id="cme_toolbox" class="cp-toolbar-container"></div> <div id="cme_toolbox" class="cp-toolbar-container"></div>
<div id="cp-app-slide-editor"> <div id="cp-app-slide-editor">
<textarea id="editor1" name="editor1"></textarea> <div id="cp-app-slide-editor-container">
<textarea id="editor1" name="editor1"></textarea>
</div>
<div class="cp-app-slide-viewer" tabindex="2"> <div class="cp-app-slide-viewer" tabindex="2">
<div id="cp-app-slide-modal"> <div id="cp-app-slide-modal">
<div id="cp-app-slide-modal-exit" class="cp-app-slide-modal-button"> <div id="cp-app-slide-modal-exit" class="cp-app-slide-modal-button">

@ -358,6 +358,13 @@ define([
}); });
}; };
var mkMarkdownToolbar = function (framework, editor) {
var $codeMirrorContainer = $('#cp-app-slide-editor-container');
var markdownTb = framework._.sfCommon.createMarkdownToolbar(editor);
$codeMirrorContainer.prepend(markdownTb.toolbar);
framework._.toolbar.$rightside.append(markdownTb.button);
};
var activateLinks = function ($content, framework) { var activateLinks = function ($content, framework) {
$content.click(function (e) { $content.click(function (e) {
if (!e.target) { return; } if (!e.target) { return; }
@ -396,6 +403,7 @@ define([
mkColorConfiguration(framework, $modal); mkColorConfiguration(framework, $modal);
mkFilePicker(framework, editor); mkFilePicker(framework, editor);
mkSlidePreviewPane(framework, $contentContainer); mkSlidePreviewPane(framework, $contentContainer);
mkMarkdownToolbar(framework, editor);
CodeMirror.configureTheme(); CodeMirror.configureTheme();

Loading…
Cancel
Save