|
|
@ -15,6 +15,7 @@ define([
|
|
|
|
var LAG_ELEM_CLS = 'rtwysiwyg-lag';
|
|
|
|
var LAG_ELEM_CLS = 'rtwysiwyg-lag';
|
|
|
|
|
|
|
|
|
|
|
|
var SAVE_ELEMENT_CLS = 'cryptpad-saveContent';
|
|
|
|
var SAVE_ELEMENT_CLS = 'cryptpad-saveContent';
|
|
|
|
|
|
|
|
var LOAD_ELEMENT_CLS = 'cryptpad-loadContent';
|
|
|
|
|
|
|
|
|
|
|
|
/** The toolbar class which contains the user list, debug link and lag. */
|
|
|
|
/** The toolbar class which contains the user list, debug link and lag. */
|
|
|
|
var TOOLBAR_CLS = 'rtwysiwyg-toolbar';
|
|
|
|
var TOOLBAR_CLS = 'rtwysiwyg-toolbar';
|
|
|
@ -38,70 +39,106 @@ define([
|
|
|
|
'</div>'
|
|
|
|
'</div>'
|
|
|
|
);
|
|
|
|
);
|
|
|
|
var toolbar = $container.find('#'+id);
|
|
|
|
var toolbar = $container.find('#'+id);
|
|
|
|
toolbar.append([
|
|
|
|
|
|
|
|
'<style>',
|
|
|
|
var swap = function (str, dict) {
|
|
|
|
'.' + TOOLBAR_CLS + ' {',
|
|
|
|
return str.replace(/\{\{(.*?)\}\}/g, function (all, block) {
|
|
|
|
' color: #666;',
|
|
|
|
//console.log(block);
|
|
|
|
' font-weight: bold;',
|
|
|
|
return dict[block] || block;
|
|
|
|
// ' background-color: #f0f0ee;',
|
|
|
|
});
|
|
|
|
// ' border-bottom: 1px solid #DDD;',
|
|
|
|
};
|
|
|
|
// ' border-top: 3px solid #CCC;',
|
|
|
|
|
|
|
|
// ' border-right: 2px solid #CCC;',
|
|
|
|
var css = swap(function(){/*
|
|
|
|
// ' border-left: 2px solid #CCC;',
|
|
|
|
<style>
|
|
|
|
' height: 26px;',
|
|
|
|
.{{TOOLBAR_CLS}} {
|
|
|
|
' margin-bottom: -3px;',
|
|
|
|
color: #666;
|
|
|
|
' display: inline-block;',
|
|
|
|
font-weight: bold;
|
|
|
|
' width: 100%;',
|
|
|
|
height: 26px;
|
|
|
|
'}',
|
|
|
|
margin-bottom: -3px;
|
|
|
|
'.' + TOOLBAR_CLS + ' a {',
|
|
|
|
display: inline-block;
|
|
|
|
' float: right;',
|
|
|
|
width: 100%;
|
|
|
|
'}',
|
|
|
|
}
|
|
|
|
'.' + TOOLBAR_CLS + ' div {',
|
|
|
|
.{{TOOLBAR_CLS}} a {
|
|
|
|
' padding: 0 10px;',
|
|
|
|
float: right;
|
|
|
|
' height: 1.5em;',
|
|
|
|
}
|
|
|
|
// ' background: #f0f0ee;',
|
|
|
|
.{{TOOLBAR_CLS}} div {
|
|
|
|
' line-height: 25px;',
|
|
|
|
padding: 0 10px;
|
|
|
|
' height: 22px;',
|
|
|
|
height: 1.5em;
|
|
|
|
'}',
|
|
|
|
line-height: 25px;
|
|
|
|
'.' + TOOLBAR_CLS + ' div.rtwysiwyg-back {',
|
|
|
|
height: 22px;
|
|
|
|
' padding: 0;',
|
|
|
|
}
|
|
|
|
' font-weight: bold;',
|
|
|
|
.{{TOOLBAR_CLS}} div.rtwysiwyg-back {
|
|
|
|
' cursor: pointer;',
|
|
|
|
padding: 0;
|
|
|
|
' color: #000;',
|
|
|
|
font-weight: bold;
|
|
|
|
'}',
|
|
|
|
cursor: pointer;
|
|
|
|
'.' + USERNAME_BUTTON_GROUP + ' {',
|
|
|
|
color: #000;
|
|
|
|
' float: left;',
|
|
|
|
}
|
|
|
|
'}',
|
|
|
|
.{{USERNAME_BUTTON_GROUP}} {
|
|
|
|
'.' + USERNAME_BUTTON_GROUP + ' button {',
|
|
|
|
float: left;
|
|
|
|
' padding: 0;',
|
|
|
|
cursor: pointer;
|
|
|
|
' margin-right: 5px;',
|
|
|
|
}
|
|
|
|
'}',
|
|
|
|
.{{USERNAME_BUTTON_GROUP}} button {
|
|
|
|
'.rtwysiwyg-toolbar-leftside div {',
|
|
|
|
padding: 0;
|
|
|
|
' float: left;',
|
|
|
|
margin-right: 5px;
|
|
|
|
'}',
|
|
|
|
}
|
|
|
|
'.rtwysiwyg-toolbar-leftside {',
|
|
|
|
.rtwysiwyg-toolbar-leftside div {
|
|
|
|
' float: left;',
|
|
|
|
float: left;
|
|
|
|
'}',
|
|
|
|
}
|
|
|
|
'.rtwysiwyg-toolbar-rightside {',
|
|
|
|
.rtwysiwyg-toolbar-leftside {
|
|
|
|
' float: right;',
|
|
|
|
float: left;
|
|
|
|
'}',
|
|
|
|
}
|
|
|
|
'.rtwysiwyg-lag {',
|
|
|
|
.rtwysiwyg-toolbar-rightside {
|
|
|
|
' float: right;',
|
|
|
|
float: right;
|
|
|
|
'}',
|
|
|
|
}
|
|
|
|
'.rtwysiwyg-spinner {',
|
|
|
|
.rtwysiwyg-lag {
|
|
|
|
' float: left;',
|
|
|
|
float: right;
|
|
|
|
'}',
|
|
|
|
}
|
|
|
|
'.gwt-TabBar {',
|
|
|
|
.rtwysiwyg-spinner {
|
|
|
|
' display:none;',
|
|
|
|
float: left;
|
|
|
|
'}',
|
|
|
|
}
|
|
|
|
'.' + DEBUG_LINK_CLS + ':link { color:transparent; }',
|
|
|
|
.gwt-TabBar {
|
|
|
|
'.' + DEBUG_LINK_CLS + ':link:hover { color:blue; }',
|
|
|
|
display:none;
|
|
|
|
'.gwt-TabPanelBottom { border-top: 0 none; }',
|
|
|
|
}
|
|
|
|
'.' + TOOLBAR_CLS + ' button { box-sizing: border-box; height: 101%; background-color: inherit; border: 1px solid #A6A6A6; border-radius: 5px; margin-right: 5px;}',
|
|
|
|
.{{DEBUG_LINK_CLS}}:link {
|
|
|
|
'.' + TOOLBAR_CLS + ' ' + SAVE_ELEMENT_CLS + '{ float: right; margin-right: 5px; }',
|
|
|
|
color:transparent;
|
|
|
|
|
|
|
|
}
|
|
|
|
'</style>'
|
|
|
|
.{{DEBUG_LINK_CLS}}:link:hover {
|
|
|
|
].join('\n'));
|
|
|
|
color:blue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
.gwt-TabPanelBottom {
|
|
|
|
|
|
|
|
border-top: 0 none;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
.{{TOOLBAR_CLS}} button {
|
|
|
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
|
|
height: 101%;
|
|
|
|
|
|
|
|
background-color: inherit;
|
|
|
|
|
|
|
|
border: 1px solid #A6A6A6;
|
|
|
|
|
|
|
|
border-radius: 5px;
|
|
|
|
|
|
|
|
margin-right: 5px;
|
|
|
|
|
|
|
|
padding-right: 5px;
|
|
|
|
|
|
|
|
padding-left: 5px;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
.{{TOOLBAR_CLS}} .{{SAVE_ELEMENT_CLS}}, .{{TOOLBAR_CLS}} .{{LOAD_ELEMENT_CLS}} {
|
|
|
|
|
|
|
|
float: right;
|
|
|
|
|
|
|
|
margin-right: 5px;
|
|
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
.{{TOOLBAR_CLS}} .{{SAVE_ELEMENT_CLS}}:after {
|
|
|
|
|
|
|
|
content: 'EXPORT';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.{{TOOLBAR_CLS}} .{{LOAD_ELEMENT_CLS}}:after {
|
|
|
|
|
|
|
|
content: 'IMPORT';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
*/}.toString().slice(14,-3), {
|
|
|
|
|
|
|
|
TOOLBAR_CLS: TOOLBAR_CLS,
|
|
|
|
|
|
|
|
SAVE_ELEMENT_CLS: SAVE_ELEMENT_CLS,
|
|
|
|
|
|
|
|
LOAD_ELEMENT_CLS: LOAD_ELEMENT_CLS,
|
|
|
|
|
|
|
|
USERNAME_BUTTON_GROUP: USERNAME_BUTTON_GROUP,
|
|
|
|
|
|
|
|
DEBUG_LINK_CLS: DEBUG_LINK_CLS,
|
|
|
|
|
|
|
|
}).trim();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
toolbar.append(css);
|
|
|
|
return toolbar;
|
|
|
|
return toolbar;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -182,7 +219,12 @@ define([
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var createSaveElement = function (id, $container) {
|
|
|
|
var createSaveElement = function (id, $container) {
|
|
|
|
$container.append('<button class="'+ SAVE_ELEMENT_CLS + '" id="' + id + '">SAVE</button>');
|
|
|
|
$container.append('<button class="'+ SAVE_ELEMENT_CLS + '" id="' + id + '"></button>');
|
|
|
|
|
|
|
|
return $container.find('#'+id)[0];
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var createLoadElement = function (id, $container) {
|
|
|
|
|
|
|
|
$container.append('<button class="'+ LOAD_ELEMENT_CLS + '" id="' + id + '"></button>');
|
|
|
|
return $container.find('#'+id)[0];
|
|
|
|
return $container.find('#'+id)[0];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -212,8 +254,10 @@ define([
|
|
|
|
var lagElement = createLagElement(toolbar.find('.rtwysiwyg-toolbar-rightside'));
|
|
|
|
var lagElement = createLagElement(toolbar.find('.rtwysiwyg-toolbar-rightside'));
|
|
|
|
var userData = config.userData;
|
|
|
|
var userData = config.userData;
|
|
|
|
var changeNameID = config.changeNameID;
|
|
|
|
var changeNameID = config.changeNameID;
|
|
|
|
var saveContentID = config.saveContentID;
|
|
|
|
var saveContentID = config.saveContentID || config.exportContentID;
|
|
|
|
|
|
|
|
var loadContentID = config.loadContentID || config.importContentID;
|
|
|
|
var saveElement;
|
|
|
|
var saveElement;
|
|
|
|
|
|
|
|
var loadElement;
|
|
|
|
|
|
|
|
|
|
|
|
// Check if the user is allowed to change his name
|
|
|
|
// Check if the user is allowed to change his name
|
|
|
|
if(changeNameID) {
|
|
|
|
if(changeNameID) {
|
|
|
@ -225,6 +269,10 @@ define([
|
|
|
|
saveElement = createSaveElement(saveContentID, toolbar.find('.rtwysiwyg-toolbar-rightside'));
|
|
|
|
saveElement = createSaveElement(saveContentID, toolbar.find('.rtwysiwyg-toolbar-rightside'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (loadContentID) {
|
|
|
|
|
|
|
|
loadElement = createLoadElement(loadContentID, toolbar.find('.rtwysiwyg-toolbar-rightside'));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var connected = false;
|
|
|
|
var connected = false;
|
|
|
|
|
|
|
|
|
|
|
|
userList.onChange = function(newUserData) {
|
|
|
|
userList.onChange = function(newUserData) {
|
|
|
|