|
|
|
@ -222,21 +222,19 @@ define([
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
var onModeChanged = function (mode) {
|
|
|
|
|
// TODO
|
|
|
|
|
return;
|
|
|
|
|
var $codeMirror = $iframe.find('.CodeMirror');
|
|
|
|
|
var $codeMirror = $('.CodeMirror');
|
|
|
|
|
window.clearTimeout(APP.previewTo);
|
|
|
|
|
$codeMirror.addClass('transition');
|
|
|
|
|
APP.previewTo = window.setTimeout(function () {
|
|
|
|
|
$codeMirror.removeClass('transition');
|
|
|
|
|
}, 500);
|
|
|
|
|
if (mediaTagModes.indexOf(mode) !== -1) {
|
|
|
|
|
/*if (mediaTagModes.indexOf(mode) !== -1) {
|
|
|
|
|
APP.$mediaTagButton.show();
|
|
|
|
|
} else { APP.$mediaTagButton.hide(); }
|
|
|
|
|
} else { APP.$mediaTagButton.hide(); }*/// TODO
|
|
|
|
|
|
|
|
|
|
if (mode === "markdown") {
|
|
|
|
|
APP.$previewButton.show();
|
|
|
|
|
Cryptpad.getPadAttribute('previewMode', function (e, data) {
|
|
|
|
|
common.getPadAttribute('previewMode', function (e, data) {
|
|
|
|
|
if (e) { return void console.error(e); }
|
|
|
|
|
if (data !== false) {
|
|
|
|
|
$previewContainer.show();
|
|
|
|
@ -323,33 +321,11 @@ define([
|
|
|
|
|
var $forgetPad = common.createButton('forget', true, {}, forgetCb);
|
|
|
|
|
$rightside.append($forgetPad);
|
|
|
|
|
|
|
|
|
|
// TODO
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
var fileDialogCfg = {
|
|
|
|
|
$body: $iframe.find('body'),
|
|
|
|
|
onSelect: function (href) {
|
|
|
|
|
var parsed = Cryptpad.parsePadUrl(href);
|
|
|
|
|
var hexFileName = Cryptpad.base64ToHex(parsed.hashData.channel);
|
|
|
|
|
var src = '/blob/' + hexFileName.slice(0,2) + '/' + hexFileName;
|
|
|
|
|
var mt = '<media-tag src="' + src + '" data-crypto-key="cryptpad:' + parsed.hashData.key + '"></media-tag>';
|
|
|
|
|
editor.replaceSelection(mt);
|
|
|
|
|
},
|
|
|
|
|
data: APP
|
|
|
|
|
};
|
|
|
|
|
APP.$mediaTagButton = $('<button>', {
|
|
|
|
|
title: Messages.filePickerButton,
|
|
|
|
|
'class': 'rightside-button fa fa-picture-o',
|
|
|
|
|
style: 'font-size: 17px'
|
|
|
|
|
}).click(function () {
|
|
|
|
|
Cryptpad.createFileDialog(fileDialogCfg);
|
|
|
|
|
}).appendTo($rightside);
|
|
|
|
|
|
|
|
|
|
var $previewButton = APP.$previewButton = Cryptpad.createButton(null, true);
|
|
|
|
|
var $previewButton = APP.$previewButton = common.createButton(null, true);
|
|
|
|
|
$previewButton.removeClass('fa-question').addClass('fa-eye');
|
|
|
|
|
$previewButton.attr('title', Messages.previewButtonTitle);
|
|
|
|
|
$previewButton.click(function () {
|
|
|
|
|
var $codeMirror = $iframe.find('.CodeMirror');
|
|
|
|
|
var $codeMirror = $('.CodeMirror');
|
|
|
|
|
window.clearTimeout(APP.previewTo);
|
|
|
|
|
$codeMirror.addClass('transition');
|
|
|
|
|
APP.previewTo = window.setTimeout(function () {
|
|
|
|
@ -362,14 +338,14 @@ define([
|
|
|
|
|
if ($previewContainer.is(':visible')) {
|
|
|
|
|
forceDrawPreview();
|
|
|
|
|
$codeMirror.removeClass('fullPage');
|
|
|
|
|
Cryptpad.setPadAttribute('previewMode', true, function (e) {
|
|
|
|
|
$previewButton.addClass('active');
|
|
|
|
|
common.setPadAttribute('previewMode', true, function (e) {
|
|
|
|
|
if (e) { return console.log(e); }
|
|
|
|
|
});
|
|
|
|
|
$previewButton.addClass('active');
|
|
|
|
|
} else {
|
|
|
|
|
$codeMirror.addClass('fullPage');
|
|
|
|
|
$previewButton.removeClass('active');
|
|
|
|
|
Cryptpad.setPadAttribute('previewMode', false, function (e) {
|
|
|
|
|
common.setPadAttribute('previewMode', false, function (e) {
|
|
|
|
|
if (e) { return console.log(e); }
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
@ -384,6 +360,28 @@ define([
|
|
|
|
|
else {
|
|
|
|
|
CodeMirror.configureTheme();
|
|
|
|
|
}
|
|
|
|
|
// TODO
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
var fileDialogCfg = {
|
|
|
|
|
$body: $iframe.find('body'),
|
|
|
|
|
onSelect: function (href) {
|
|
|
|
|
var parsed = Cryptpad.parsePadUrl(href);
|
|
|
|
|
var hexFileName = Cryptpad.base64ToHex(parsed.hashData.channel);
|
|
|
|
|
var src = '/blob/' + hexFileName.slice(0,2) + '/' + hexFileName;
|
|
|
|
|
var mt = '<media-tag src="' + src + '" data-crypto-key="cryptpad:' + parsed.hashData.key + '"></media-tag>';
|
|
|
|
|
editor.replaceSelection(mt);
|
|
|
|
|
},
|
|
|
|
|
data: APP
|
|
|
|
|
};
|
|
|
|
|
APP.$mediaTagButton = $('<button>', {
|
|
|
|
|
title: Messages.filePickerButton,
|
|
|
|
|
'class': 'rightside-button fa fa-picture-o',
|
|
|
|
|
style: 'font-size: 17px'
|
|
|
|
|
}).click(function () {
|
|
|
|
|
Cryptpad.createFileDialog(fileDialogCfg);
|
|
|
|
|
}).appendTo($rightside);
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
config.onReady = function (info) {
|
|
|
|
@ -439,14 +437,13 @@ define([
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* TODO RPC
|
|
|
|
|
Cryptpad.getPadAttribute('previewMode', function (e, data) {
|
|
|
|
|
common.getPadAttribute('previewMode', function (e, data) {
|
|
|
|
|
if (e) { return void console.error(e); }
|
|
|
|
|
if (data === false && APP.$previewButton) {
|
|
|
|
|
APP.$previewButton.click();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
// add the splitter
|
|
|
|
|