|
|
@ -440,9 +440,8 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
var andThen2 = function (editor, Ckeditor, framework) {
|
|
|
|
var andThen2 = function (editor, Ckeditor, framework) {
|
|
|
|
var mediaTagMap = {};
|
|
|
|
var mediaTagMap = {};
|
|
|
|
var $bar = $('#cke_1_toolbox');
|
|
|
|
|
|
|
|
var $contentContainer = $('#cke_1_contents');
|
|
|
|
var $contentContainer = $('#cke_1_contents');
|
|
|
|
var $html = $bar.closest('html');
|
|
|
|
var $html = $('html');
|
|
|
|
var $faLink = $html.find('head link[href*="/bower_components/components-font-awesome/css/font-awesome.min.css"]');
|
|
|
|
var $faLink = $html.find('head link[href*="/bower_components/components-font-awesome/css/font-awesome.min.css"]');
|
|
|
|
if ($faLink.length) {
|
|
|
|
if ($faLink.length) {
|
|
|
|
$html.find('iframe').contents().find('head').append($faLink.clone());
|
|
|
|
$html.find('iframe').contents().find('head').append($faLink.clone());
|
|
|
@ -494,30 +493,10 @@ define([
|
|
|
|
framework: framework,
|
|
|
|
framework: framework,
|
|
|
|
metadataMgr: metadataMgr,
|
|
|
|
metadataMgr: metadataMgr,
|
|
|
|
common: common,
|
|
|
|
common: common,
|
|
|
|
editor: editor
|
|
|
|
editor: editor,
|
|
|
|
|
|
|
|
container: $('#cp-app-pad-comments')[0]
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
editor.plugins.comments.addComment = function (uid, cb) {
|
|
|
|
|
|
|
|
if (!comments) {
|
|
|
|
|
|
|
|
comments = Util.clone(COMMENTS);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// XXX display input
|
|
|
|
|
|
|
|
UI.prompt("Message", "", function (val) {
|
|
|
|
|
|
|
|
if (!val) { return; }
|
|
|
|
|
|
|
|
if (!editor.getSelection().getSelectedText()) {
|
|
|
|
|
|
|
|
// text has been deleted by another user while we were typing our comment?
|
|
|
|
|
|
|
|
return void UI.warn(Messages.error);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var myId = updateAuthorData();
|
|
|
|
|
|
|
|
comments.messages[uid] = {
|
|
|
|
|
|
|
|
user: myId,
|
|
|
|
|
|
|
|
time: +new Date(),
|
|
|
|
|
|
|
|
message: val
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
cb();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var onLinkClicked = function (e) {
|
|
|
|
var onLinkClicked = function (e) {
|
|
|
|
var $target = $(e.target);
|
|
|
|
var $target = $(e.target);
|
|
|
|
if (!$target.is('a')) { return; }
|
|
|
|
if (!$target.is('a')) { return; }
|
|
|
@ -717,7 +696,6 @@ define([
|
|
|
|
return hjson;
|
|
|
|
return hjson;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$bar.find('#cke_1_toolbar_collapser').hide();
|
|
|
|
|
|
|
|
if (!framework.isReadOnly()) {
|
|
|
|
if (!framework.isReadOnly()) {
|
|
|
|
addToolbarHideBtn(framework, $contentContainer);
|
|
|
|
addToolbarHideBtn(framework, $contentContainer);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -776,7 +754,7 @@ define([
|
|
|
|
framework._.sfCommon.getAttribute(['pad', 'width'], function (err, data) {
|
|
|
|
framework._.sfCommon.getAttribute(['pad', 'width'], function (err, data) {
|
|
|
|
var active = data || typeof(data) === "undefined";
|
|
|
|
var active = data || typeof(data) === "undefined";
|
|
|
|
if (active) {
|
|
|
|
if (active) {
|
|
|
|
$iframe.find('html').addClass('cke_body_width');
|
|
|
|
$contentContainer.addClass('cke_body_width');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var $width = framework._.sfCommon.createButton('', true, {
|
|
|
|
var $width = framework._.sfCommon.createButton('', true, {
|
|
|
|
icon: 'fa-arrows-h',
|
|
|
|
icon: 'fa-arrows-h',
|
|
|
@ -784,9 +762,9 @@ define([
|
|
|
|
name: "pad-width",
|
|
|
|
name: "pad-width",
|
|
|
|
},function () {
|
|
|
|
},function () {
|
|
|
|
if (active) {
|
|
|
|
if (active) {
|
|
|
|
$iframe.find('html').removeClass('cke_body_width');
|
|
|
|
$contentContainer.removeClass('cke_body_width');
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$iframe.find('html').addClass('cke_body_width');
|
|
|
|
$contentContainer.addClass('cke_body_width');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
active = !active;
|
|
|
|
active = !active;
|
|
|
|
var key = active ? Messages.pad_useFullWidth : Messages.pad_usePageWidth;
|
|
|
|
var key = active ? Messages.pad_useFullWidth : Messages.pad_usePageWidth;
|
|
|
@ -959,8 +937,8 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
nThen(function (waitFor) {
|
|
|
|
nThen(function (waitFor) {
|
|
|
|
Framework.create({
|
|
|
|
Framework.create({
|
|
|
|
toolbarContainer: '#cke_1_toolbox',
|
|
|
|
toolbarContainer: '#cp-app-pad-toolbar',
|
|
|
|
contentContainer: '#cke_editor1 > .cke_inner',
|
|
|
|
contentContainer: '#cp-app-pad-editor',
|
|
|
|
patchTransformer: ChainPad.NaiveJSONTransformer,
|
|
|
|
patchTransformer: ChainPad.NaiveJSONTransformer,
|
|
|
|
/*thumbnail: {
|
|
|
|
/*thumbnail: {
|
|
|
|
getContainer: function () { return $('iframe').contents().find('html')[0]; },
|
|
|
|
getContainer: function () { return $('iframe').contents().find('html')[0]; },
|
|
|
@ -1004,14 +982,6 @@ define([
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Used in ckeditor-config.js
|
|
|
|
// Used in ckeditor-config.js
|
|
|
|
Ckeditor.CRYPTPAD_URLARGS = ApiConfig.requireConf.urlArgs;
|
|
|
|
Ckeditor.CRYPTPAD_URLARGS = ApiConfig.requireConf.urlArgs;
|
|
|
|
var backColor = AppConfig.appBackgroundColor;
|
|
|
|
|
|
|
|
var newCss = '.cke_body_width { background: '+ backColor +'; height: 100%; overflow: auto;}' +
|
|
|
|
|
|
|
|
'.cke_body_width body {' +
|
|
|
|
|
|
|
|
'max-width: 50em; padding: 20px 30px; margin: 0 auto; min-height: 100%;'+
|
|
|
|
|
|
|
|
'box-sizing: border-box; overflow: auto;'+
|
|
|
|
|
|
|
|
'}' +
|
|
|
|
|
|
|
|
'.cke_body_width body > *:first-child { margin-top: 0; }';
|
|
|
|
|
|
|
|
Ckeditor.addCss(newCss);
|
|
|
|
|
|
|
|
Ckeditor._mediatagTranslations = {
|
|
|
|
Ckeditor._mediatagTranslations = {
|
|
|
|
title: Messages.pad_mediatagTitle,
|
|
|
|
title: Messages.pad_mediatagTitle,
|
|
|
|
width: Messages.pad_mediatagWidth,
|
|
|
|
width: Messages.pad_mediatagWidth,
|
|
|
@ -1037,13 +1007,11 @@ define([
|
|
|
|
Links.addSupportForOpeningLinksInNewTab(Ckeditor)({editor: editor});
|
|
|
|
Links.addSupportForOpeningLinksInNewTab(Ckeditor)({editor: editor});
|
|
|
|
}).nThen(function () {
|
|
|
|
}).nThen(function () {
|
|
|
|
// Move ckeditor parts to have a structure like the other apps
|
|
|
|
// Move ckeditor parts to have a structure like the other apps
|
|
|
|
var $toolbarContainer = $('#cke_1_top');
|
|
|
|
|
|
|
|
var $contentContainer = $('#cke_1_contents');
|
|
|
|
var $contentContainer = $('#cke_1_contents');
|
|
|
|
var $mainContainer = $('#cke_editor1');
|
|
|
|
var $mainContainer = $('#cke_editor1 > .cke_inner');
|
|
|
|
$contentContainer.prepend($toolbarContainer.find('.cke_toolbox_main'));
|
|
|
|
var $ckeToolbar = $('#cke_1_top').find('.cke_toolbox_main');
|
|
|
|
$mainContainer.prepend($toolbarContainer);
|
|
|
|
$mainContainer.prepend($ckeToolbar.addClass('cke_reset_all'));
|
|
|
|
$contentContainer.find('.cke_toolbox_main').addClass('cke_reset_all');
|
|
|
|
$contentContainer.append(h('div#cp-app-pad-comments'));
|
|
|
|
$toolbarContainer.removeClass('cke_reset_all');
|
|
|
|
|
|
|
|
}).nThen(waitFor());
|
|
|
|
}).nThen(waitFor());
|
|
|
|
|
|
|
|
|
|
|
|
}).nThen(function (/*waitFor*/) {
|
|
|
|
}).nThen(function (/*waitFor*/) {
|
|
|
|