|
|
@ -222,21 +222,19 @@ define([
|
|
|
|
];
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
var onModeChanged = function (mode) {
|
|
|
|
var onModeChanged = function (mode) {
|
|
|
|
// TODO
|
|
|
|
var $codeMirror = $('.CodeMirror');
|
|
|
|
return;
|
|
|
|
|
|
|
|
var $codeMirror = $iframe.find('.CodeMirror');
|
|
|
|
|
|
|
|
window.clearTimeout(APP.previewTo);
|
|
|
|
window.clearTimeout(APP.previewTo);
|
|
|
|
$codeMirror.addClass('transition');
|
|
|
|
$codeMirror.addClass('transition');
|
|
|
|
APP.previewTo = window.setTimeout(function () {
|
|
|
|
APP.previewTo = window.setTimeout(function () {
|
|
|
|
$codeMirror.removeClass('transition');
|
|
|
|
$codeMirror.removeClass('transition');
|
|
|
|
}, 500);
|
|
|
|
}, 500);
|
|
|
|
if (mediaTagModes.indexOf(mode) !== -1) {
|
|
|
|
/*if (mediaTagModes.indexOf(mode) !== -1) {
|
|
|
|
APP.$mediaTagButton.show();
|
|
|
|
APP.$mediaTagButton.show();
|
|
|
|
} else { APP.$mediaTagButton.hide(); }
|
|
|
|
} else { APP.$mediaTagButton.hide(); }*/// TODO
|
|
|
|
|
|
|
|
|
|
|
|
if (mode === "markdown") {
|
|
|
|
if (mode === "markdown") {
|
|
|
|
APP.$previewButton.show();
|
|
|
|
APP.$previewButton.show();
|
|
|
|
Cryptpad.getPadAttribute('previewMode', function (e, data) {
|
|
|
|
common.getPadAttribute('previewMode', function (e, data) {
|
|
|
|
if (e) { return void console.error(e); }
|
|
|
|
if (e) { return void console.error(e); }
|
|
|
|
if (data !== false) {
|
|
|
|
if (data !== false) {
|
|
|
|
$previewContainer.show();
|
|
|
|
$previewContainer.show();
|
|
|
@ -323,33 +321,11 @@ define([
|
|
|
|
var $forgetPad = common.createButton('forget', true, {}, forgetCb);
|
|
|
|
var $forgetPad = common.createButton('forget', true, {}, forgetCb);
|
|
|
|
$rightside.append($forgetPad);
|
|
|
|
$rightside.append($forgetPad);
|
|
|
|
|
|
|
|
|
|
|
|
// TODO
|
|
|
|
var $previewButton = APP.$previewButton = common.createButton(null, true);
|
|
|
|
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);
|
|
|
|
|
|
|
|
$previewButton.removeClass('fa-question').addClass('fa-eye');
|
|
|
|
$previewButton.removeClass('fa-question').addClass('fa-eye');
|
|
|
|
$previewButton.attr('title', Messages.previewButtonTitle);
|
|
|
|
$previewButton.attr('title', Messages.previewButtonTitle);
|
|
|
|
$previewButton.click(function () {
|
|
|
|
$previewButton.click(function () {
|
|
|
|
var $codeMirror = $iframe.find('.CodeMirror');
|
|
|
|
var $codeMirror = $('.CodeMirror');
|
|
|
|
window.clearTimeout(APP.previewTo);
|
|
|
|
window.clearTimeout(APP.previewTo);
|
|
|
|
$codeMirror.addClass('transition');
|
|
|
|
$codeMirror.addClass('transition');
|
|
|
|
APP.previewTo = window.setTimeout(function () {
|
|
|
|
APP.previewTo = window.setTimeout(function () {
|
|
|
@ -362,14 +338,14 @@ define([
|
|
|
|
if ($previewContainer.is(':visible')) {
|
|
|
|
if ($previewContainer.is(':visible')) {
|
|
|
|
forceDrawPreview();
|
|
|
|
forceDrawPreview();
|
|
|
|
$codeMirror.removeClass('fullPage');
|
|
|
|
$codeMirror.removeClass('fullPage');
|
|
|
|
Cryptpad.setPadAttribute('previewMode', true, function (e) {
|
|
|
|
$previewButton.addClass('active');
|
|
|
|
|
|
|
|
common.setPadAttribute('previewMode', true, function (e) {
|
|
|
|
if (e) { return console.log(e); }
|
|
|
|
if (e) { return console.log(e); }
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$previewButton.addClass('active');
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$codeMirror.addClass('fullPage');
|
|
|
|
$codeMirror.addClass('fullPage');
|
|
|
|
$previewButton.removeClass('active');
|
|
|
|
$previewButton.removeClass('active');
|
|
|
|
Cryptpad.setPadAttribute('previewMode', false, function (e) {
|
|
|
|
common.setPadAttribute('previewMode', false, function (e) {
|
|
|
|
if (e) { return console.log(e); }
|
|
|
|
if (e) { return console.log(e); }
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -384,6 +360,28 @@ define([
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
CodeMirror.configureTheme();
|
|
|
|
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) {
|
|
|
|
config.onReady = function (info) {
|
|
|
@ -439,14 +437,13 @@ define([
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* TODO RPC
|
|
|
|
common.getPadAttribute('previewMode', function (e, data) {
|
|
|
|
Cryptpad.getPadAttribute('previewMode', function (e, data) {
|
|
|
|
|
|
|
|
if (e) { return void console.error(e); }
|
|
|
|
if (e) { return void console.error(e); }
|
|
|
|
if (data === false && APP.$previewButton) {
|
|
|
|
if (data === false && APP.$previewButton) {
|
|
|
|
APP.$previewButton.click();
|
|
|
|
APP.$previewButton.click();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
// add the splitter
|
|
|
|
// add the splitter
|
|
|
|