Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging
This commit is contained in:
@@ -10,7 +10,7 @@ CKEDITOR.editorConfig = function( config ) {
|
|||||||
// document itself and causes problems when it's sent across the wire and reflected back
|
// document itself and causes problems when it's sent across the wire and reflected back
|
||||||
config.removePlugins= 'resize,elementspath';
|
config.removePlugins= 'resize,elementspath';
|
||||||
config.resize_enabled= false; //bottom-bar
|
config.resize_enabled= false; //bottom-bar
|
||||||
config.extraPlugins= 'autolink,colorbutton,colordialog,font,indentblock,justify,mediatag';
|
config.extraPlugins= 'autolink,colorbutton,colordialog,font,indentblock,justify,mediatag,print';
|
||||||
config.toolbarGroups= [
|
config.toolbarGroups= [
|
||||||
// {"name":"clipboard","groups":["clipboard","undo"]},
|
// {"name":"clipboard","groups":["clipboard","undo"]},
|
||||||
//{"name":"editing","groups":["find","selection"]},
|
//{"name":"editing","groups":["find","selection"]},
|
||||||
@@ -23,7 +23,8 @@ CKEDITOR.editorConfig = function( config ) {
|
|||||||
{"name":"basicstyles","groups":["basicstyles","cleanup"]},
|
{"name":"basicstyles","groups":["basicstyles","cleanup"]},
|
||||||
{"name":"paragraph","groups":["list","indent","blocks","align","bidi"]},
|
{"name":"paragraph","groups":["list","indent","blocks","align","bidi"]},
|
||||||
{"name":"styles"},
|
{"name":"styles"},
|
||||||
{"name":"colors"}];
|
{"name":"colors"},
|
||||||
|
{"name":"print"}];
|
||||||
|
|
||||||
config.font_defaultLabel = 'Arial';
|
config.font_defaultLabel = 'Arial';
|
||||||
config.fontSize_defaultLabel = '16';
|
config.fontSize_defaultLabel = '16';
|
||||||
|
|||||||
@@ -372,6 +372,15 @@ define([
|
|||||||
return $toolbar;
|
return $toolbar;
|
||||||
};
|
};
|
||||||
UIElements.createMarkdownToolbar = function (common, editor) {
|
UIElements.createMarkdownToolbar = function (common, editor) {
|
||||||
|
var readOnly = common.getMetadataMgr().getPrivateData().readOnly;
|
||||||
|
if (readOnly) {
|
||||||
|
return {
|
||||||
|
toolbar: $(),
|
||||||
|
button: $(),
|
||||||
|
setState: function () {}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
var $toolbar = createMdToolbar(common, editor);
|
var $toolbar = createMdToolbar(common, editor);
|
||||||
var cfg = {
|
var cfg = {
|
||||||
title: Messages.mdToolbar_button,
|
title: Messages.mdToolbar_button,
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ define([
|
|||||||
var $rightCol = $('<span>', {'class': 'cp-toolbar-userlist-rightcol'});
|
var $rightCol = $('<span>', {'class': 'cp-toolbar-userlist-rightcol'});
|
||||||
var $nameSpan = $('<span>', {'class': 'cp-toolbar-userlist-name'}).text(name).appendTo($rightCol);
|
var $nameSpan = $('<span>', {'class': 'cp-toolbar-userlist-name'}).text(name).appendTo($rightCol);
|
||||||
var isMe = data.uid === user.uid;
|
var isMe = data.uid === user.uid;
|
||||||
if (isMe) {
|
if (isMe && !priv.readOnly) {
|
||||||
$nameSpan.html('');
|
$nameSpan.html('');
|
||||||
var $nameValue = $('<span>', {
|
var $nameValue = $('<span>', {
|
||||||
'class': 'cp-toolbar-userlist-name-value'
|
'class': 'cp-toolbar-userlist-name-value'
|
||||||
@@ -292,7 +292,8 @@ define([
|
|||||||
editingUserName.select[1]);
|
editingUserName.select[1]);
|
||||||
setTimeout(function () { $nameInput.focus(); });
|
setTimeout(function () { $nameInput.focus(); });
|
||||||
}
|
}
|
||||||
} else if (Common.isLoggedIn() && data.curvePublic && !friends[data.curvePublic]) {
|
} else if (Common.isLoggedIn() && data.curvePublic && !friends[data.curvePublic]
|
||||||
|
&& !priv.readOnly) {
|
||||||
if (pendingFriends.indexOf(data.netfluxId) !== -1) {
|
if (pendingFriends.indexOf(data.netfluxId) !== -1) {
|
||||||
$('<span>', {'class': 'cp-toolbar-userlist-friend'}).text(Messages.userlist_pending)
|
$('<span>', {'class': 'cp-toolbar-userlist-friend'}).text(Messages.userlist_pending)
|
||||||
.appendTo($rightCol);
|
.appendTo($rightCol);
|
||||||
|
|||||||
@@ -428,6 +428,10 @@ define([
|
|||||||
cursor.setToStart();
|
cursor.setToStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (framework.isReadOnly()) {
|
||||||
|
$(inner).attr('contenteditable', 'false');
|
||||||
|
}
|
||||||
|
|
||||||
var fmConfig = {
|
var fmConfig = {
|
||||||
ckeditor: editor,
|
ckeditor: editor,
|
||||||
body: $('body'),
|
body: $('body'),
|
||||||
|
|||||||
@@ -58,12 +58,24 @@ overflow-x: hidden;
|
|||||||
flex: 1;
|
flex: 1;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
&.cp-app-poll-published {
|
&.cp-app-poll-published {
|
||||||
|
#cp-app-poll-table-scroll {
|
||||||
|
max-width: ~"calc(75% - 30px - 100px)";
|
||||||
|
}
|
||||||
|
table {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
table tr td:last-child {
|
||||||
|
margin-left: 0; // uncommitted is hidden
|
||||||
|
}
|
||||||
#cp-app-poll-create-option {
|
#cp-app-poll-create-option {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
.cp-app-poll-table-remove[data-rt-id^="y"], .cp-app-poll-table-edit[data-rt-id^="y"] {
|
.cp-app-poll-table-remove[data-rt-id^="y"], .cp-app-poll-table-edit[data-rt-id^="y"] {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
td.cp-app-poll-table-uncommitted {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
tr.cp-app-poll-table-uncommitted {
|
tr.cp-app-poll-table-uncommitted {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -258,6 +258,7 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
var setTablePublished = function (bool) {
|
var setTablePublished = function (bool) {
|
||||||
|
if (APP.locked) { bool = true; }
|
||||||
if (APP.markdownTb) { APP.markdownTb.setState(!bool); }
|
if (APP.markdownTb) { APP.markdownTb.setState(!bool); }
|
||||||
if (bool) {
|
if (bool) {
|
||||||
if (APP.$publish) { APP.$publish.hide(); }
|
if (APP.$publish) { APP.$publish.hide(); }
|
||||||
@@ -369,7 +370,7 @@ define([
|
|||||||
var colsOrder = sortColumns(displayedObj.content.colsOrder, APP.userid);
|
var colsOrder = sortColumns(displayedObj.content.colsOrder, APP.userid);
|
||||||
var conf = {
|
var conf = {
|
||||||
cols: colsOrder,
|
cols: colsOrder,
|
||||||
readOnly: APP.readOnly
|
readOnly: APP.locked
|
||||||
};
|
};
|
||||||
var f = getFocus();
|
var f = getFocus();
|
||||||
APP.$createRow.detach();
|
APP.$createRow.detach();
|
||||||
@@ -452,7 +453,7 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
var hideInputs = function (id) {
|
var hideInputs = function (id) {
|
||||||
if (APP.readOnly) { return; }
|
if (APP.locked) { return; }
|
||||||
if (id) {
|
if (id) {
|
||||||
var type = Render.typeofId(id);
|
var type = Render.typeofId(id);
|
||||||
if (type === 'col') { return void lockColumn(id); }
|
if (type === 'col') { return void lockColumn(id); }
|
||||||
@@ -538,7 +539,7 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
var handleClick = function (e, isKeyup) {
|
var handleClick = function (e, isKeyup) {
|
||||||
if (APP.readOnly) { return; }
|
if (APP.locked) { return; }
|
||||||
|
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
@@ -617,6 +618,7 @@ define([
|
|||||||
// If readOnly, always put the app in published mode
|
// If readOnly, always put the app in published mode
|
||||||
bool = true;
|
bool = true;
|
||||||
}
|
}
|
||||||
|
console.log(bool);
|
||||||
$(APP.$mediaTagButton).toggle(!bool);
|
$(APP.$mediaTagButton).toggle(!bool);
|
||||||
setTablePublished(bool);
|
setTablePublished(bool);
|
||||||
/*['textarea'].forEach(function (sel) {
|
/*['textarea'].forEach(function (sel) {
|
||||||
@@ -650,7 +652,7 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
var setEditable = function (editable) {
|
var setEditable = function (editable) {
|
||||||
APP.readOnly = !editable;
|
APP.locked = APP.readOnly || !editable;
|
||||||
|
|
||||||
if (editable === false) {
|
if (editable === false) {
|
||||||
// disable all the things
|
// disable all the things
|
||||||
@@ -897,20 +899,18 @@ define([
|
|||||||
var uncommitted = APP.uncommitted = {};
|
var uncommitted = APP.uncommitted = {};
|
||||||
prepareProxy(proxy, copyObject(Render.Example));
|
prepareProxy(proxy, copyObject(Render.Example));
|
||||||
prepareProxy(uncommitted, copyObject(Render.Example));
|
prepareProxy(uncommitted, copyObject(Render.Example));
|
||||||
if (!APP.readOnly) {
|
var coluid = Render.coluid();
|
||||||
var coluid = Render.coluid();
|
if (userid) {
|
||||||
if (userid) {
|
// If userid exists, it means the user already has a pinned column
|
||||||
// If userid exists, it means the user already has a pinned column
|
// and we should unlock it
|
||||||
// and we should unlock it
|
unlockColumn(userid);
|
||||||
unlockColumn(userid);
|
|
||||||
}
|
|
||||||
uncommitted.content.colsOrder.push(coluid);
|
|
||||||
unlockColumn(coluid);
|
|
||||||
|
|
||||||
var rowuid = Render.rowuid();
|
|
||||||
uncommitted.content.rowsOrder.push(rowuid);
|
|
||||||
unlockRow(rowuid);
|
|
||||||
}
|
}
|
||||||
|
uncommitted.content.colsOrder.push(coluid);
|
||||||
|
unlockColumn(coluid);
|
||||||
|
|
||||||
|
var rowuid = Render.rowuid();
|
||||||
|
uncommitted.content.rowsOrder.push(rowuid);
|
||||||
|
unlockRow(rowuid);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Extract uncommitted data (row or column) and create a new uncommitted row or column
|
Extract uncommitted data (row or column) and create a new uncommitted row or column
|
||||||
@@ -1181,19 +1181,10 @@ define([
|
|||||||
}));
|
}));
|
||||||
SFCommon.create(waitFor(function (c) { APP.common = common = c; }));
|
SFCommon.create(waitFor(function (c) { APP.common = common = c; }));
|
||||||
}).nThen(function (waitFor) {
|
}).nThen(function (waitFor) {
|
||||||
var privReady = Util.once(waitFor());
|
common.getSframeChannel().onReady(waitFor());
|
||||||
var metadataMgr = common.getMetadataMgr();
|
|
||||||
if (JSON.stringify(metadataMgr.getPrivateData()) !== '{}') {
|
|
||||||
privReady();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
metadataMgr.onChange(function () {
|
|
||||||
if (typeof(metadataMgr.getPrivateData().readOnly) === 'boolean') {
|
|
||||||
APP.readOnly = metadataMgr.getPrivateData().readOnly;
|
|
||||||
privReady();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}).nThen(function (/* waitFor */) {
|
}).nThen(function (/* waitFor */) {
|
||||||
|
var metadataMgr = common.getMetadataMgr();
|
||||||
|
APP.locked = APP.readOnly = metadataMgr.getPrivateData().readOnly;
|
||||||
APP.loggedIn = common.isLoggedIn();
|
APP.loggedIn = common.isLoggedIn();
|
||||||
APP.SFCommon = common;
|
APP.SFCommon = common;
|
||||||
|
|
||||||
@@ -1235,6 +1226,7 @@ define([
|
|||||||
if (APP.readOnly) {
|
if (APP.readOnly) {
|
||||||
$('#cp-app-poll-create-user, #cp-app-poll-create-option, #cp-app-poll-comments-add')
|
$('#cp-app-poll-create-user, #cp-app-poll-create-option, #cp-app-poll-comments-add')
|
||||||
.remove();
|
.remove();
|
||||||
|
$('#cp-app-poll-comments-add-title').remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
var rt = APP.rt = Listmap.create(listmapConfig);
|
var rt = APP.rt = Listmap.create(listmapConfig);
|
||||||
|
|||||||
Reference in New Issue
Block a user