Merge branch 'staging' into help-menu

pull/1/head
ansuz 5 years ago
commit c185efffcc

@ -24,7 +24,7 @@
"ckeditor": "4.14.0",
"codemirror": "^5.19.0",
"requirejs": "2.3.5",
"marked": "0.5.0",
"marked": "1.1.0",
"rangy": "rangy-release#~1.3.0",
"json.sortify": "~2.1.0",
"secure-fabric.js": "secure-v1.7.9",

@ -9,5 +9,7 @@ define(['/common/application_config_internal.js'], function (AppConfig) {
// Example: If you want to remove the survey link in the menu:
// AppConfig.surveyURL = "";
AppConfig.supportLanguages = [ 'en', 'fr' ]; // XXX
return AppConfig;
});

@ -26,4 +26,6 @@
<glyph unicode="&#xe910;" glyph-name="new-template" d="M840.764 886.152h-655.119c-35.33 0-63.97-28.64-63.97-63.97v0-787.637c0-35.33 28.64-63.97 63.97-63.97v0h655.119c35.33 0 63.97 28.64 63.97 63.97v0 787.637c0 35.33-28.64 63.97-63.97 63.97v0zM844.499 34.545c0-2.063-1.672-3.735-3.735-3.735v0h-655.119c-2.063 0-3.735 1.672-3.735 3.735v0 787.637c0 2.063 1.672 3.735 3.735 3.735h655.119c2.063 0 3.735-1.672 3.735-3.735v0zM643.915 466.071h-93.365v93.003c0 10.313-8.36 18.673-18.673 18.673v0h-37.346c-0.036 0-0.078 0-0.121 0-10.246 0-18.552-8.306-18.552-18.552 0-0.042 0-0.085 0-0.127v0.006-93.003h-93.365c-0.036 0-0.078 0-0.121 0-10.246 0-18.552-8.306-18.552-18.552 0-0.042 0-0.085 0-0.127v0.006-37.346c0-10.313 8.36-18.673 18.673-18.673v0h93.365v-93.967c0-0.036 0-0.078 0-0.121 0-10.246 8.306-18.552 18.552-18.552 0.042 0 0.085 0 0.127 0h37.34c10.313 0 18.673 8.36 18.673 18.673v0 93.606h93.365c10.285 0.068 18.605 8.388 18.673 18.666v37.352c0.002 0.108 0.003 0.234 0.003 0.361 0 10.313-8.36 18.673-18.673 18.673-0.001 0-0.002 0-0.004 0v0z" />
<glyph unicode="&#xe911;" glyph-name="palette" d="M408.6 950c-198.8-38.8-359-198.6-398.2-396.8-74-374 263.4-652.8 517.6-613.4 82.4 12.8 122.8 109.2 85 183.4-46.2 90.8 19.8 196.8 121.8 196.8h159.4c71.6 0 129.6 59.2 129.8 130.6-1 315.2-287.8 563.2-615.4 499.4zM192 320c-35.4 0-64 28.6-64 64s28.6 64 64 64 64-28.6 64-64-28.6-64-64-64zM256 576c-35.4 0-64 28.6-64 64s28.6 64 64 64 64-28.6 64-64-28.6-64-64-64zM512 704c-35.4 0-64 28.6-64 64s28.6 64 64 64 64-28.6 64-64-28.6-64-64-64zM768 576c-35.4 0-64 28.6-64 64s28.6 64 64 64 64-28.6 64-64-28.6-64-64-64z" />
<glyph unicode="&#xe912;" glyph-name="folder-upload" d="M829.44 727.251h-296.84l-47.104 62.886c-25.923 34.066-66.406 55.898-111.999 56.139h-178.938c-77.457-0.137-140.211-62.891-140.348-140.335v-515.868c0.137-77.457 62.891-140.211 140.335-140.348h634.893c77.457 0.137 140.211 62.891 140.348 140.335v396.482c0 0.036 0 0.078 0 0.121 0 77.561-62.807 140.452-140.335 140.589h-0.013zM911.119 190.072c-0.068-45.083-36.597-81.611-81.673-81.679h-634.887c-45.083 0.068-81.611 36.597-81.679 81.673v515.862c0.068 45.083 36.597 81.611 81.673 81.679h178.906c26.48-0.030 50.004-12.656 64.908-32.207l0.146-0.199 47.104-62.765 17.709-24.094h326.114c45.125-0.069 81.679-36.665 81.679-81.799 0 0 0 0 0 0v0zM562.838 166.883h-102.039v203.957h-72.523l123.723 214.076 123.723-214.076h-72.885v-203.957z" />
<glyph unicode="&#xe913;" glyph-name="add-bottom" d="M108.793 271.501c-15.312 0-27.996 12.684-27.996 27.996v55.992c0 15.312 12.684 28.006 27.996 28.006h225.414v-111.993zM108.793 495.478c-15.312 0-27.996 12.694-27.996 28.006v55.992c0 15.312 12.684 27.996 27.996 27.996h403.491v-111.993zM108.793 719.465c-15.312 0-27.996 12.694-27.996 28.006v55.992c0 15.312 12.684 27.996 27.996 27.996h615.968c15.312 0 27.996-12.684 27.996-27.996v-55.992c0-15.312-12.684-28.006-27.996-28.006zM943.202 287.839c0-19.465-15.792-35.257-35.258-35.257h-152.782v-152.782c0-19.465-15.792-35.257-35.258-35.257h-70.515c-19.465 0-35.257 15.792-35.257 35.257v152.782h-152.782c-19.465 0-35.257 15.792-35.257 35.257v70.515c0 19.465 15.792 35.258 35.257 35.258h152.782v152.782c0 19.465 15.792 35.258 35.257 35.258h70.515c19.465 0 35.258-15.792 35.258-35.258v-152.782h152.782c19.465 0 35.258-15.792 35.258-35.258z" />
<glyph unicode="&#xe914;" glyph-name="add-top" d="M108.793 624.499c-15.312 0-27.996-12.684-27.996-27.996v-55.992c0-15.312 12.684-28.006 27.996-28.006h225.414v111.993zM108.793 400.522c-15.312 0-27.996-12.694-27.996-28.006v-55.992c0-15.312 12.684-27.996 27.996-27.996h403.491v111.993zM108.793 176.535c-15.312 0-27.996-12.694-27.996-28.006v-55.992c0-15.312 12.684-27.996 27.996-27.996h615.968c15.312 0 27.996 12.684 27.996 27.996v55.992c0 15.312-12.684 28.006-27.996 28.006zM943.202 608.161c0 19.465-15.792 35.257-35.258 35.257h-152.782v152.782c0 19.465-15.792 35.257-35.258 35.257h-70.515c-19.465 0-35.257-15.792-35.257-35.257v-152.782h-152.782c-19.465 0-35.257-15.792-35.257-35.257v-70.515c0-19.465 15.792-35.258 35.257-35.258h152.782v-152.782c0-19.465 15.792-35.258 35.257-35.258h70.515c19.465 0 35.258 15.792 35.258 35.258v152.782h152.782c19.465 0 35.258 15.792 35.258 35.258z" />
</font></defs></svg>

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 24 KiB

@ -1,11 +1,12 @@
@font-face {
font-family: 'cptools';
src:
url('fonts/cptools.ttf?cljhos') format('truetype'),
url('fonts/cptools.woff?cljhos') format('woff'),
url('fonts/cptools.svg?cljhos#cptools') format('svg');
url('fonts/cptools.ttf?da4x1y') format('truetype'),
url('fonts/cptools.woff?da4x1y') format('woff'),
url('fonts/cptools.svg?da4x1y#cptools') format('svg');
font-weight: normal;
font-style: normal;
font-display: block;
}
.cptools {
@ -24,6 +25,12 @@
-moz-osx-font-smoothing: grayscale;
}
.cptools-add-bottom:before {
content: "\e913";
}
.cptools-add-top:before {
content: "\e914";
}
.cptools-folder-upload:before {
content: "\e912";
}

@ -21,7 +21,6 @@
}
* {
visibility: hidden;
height: auto;
max-height: none;
}
.cp-app-slide-viewer #cp-app-slide-print {

@ -20,7 +20,7 @@ define(function() {
* users and these users will be redirected to the login page if they still try to access
* the app
*/
config.registeredOnlyTypes = ['file', 'contacts', 'oodoc', 'ooslide', 'notifications'];
config.registeredOnlyTypes = ['file', 'contacts', 'oodoc', 'ooslide', 'notifications', 'support'];
/* CryptPad is available is multiple languages, but only English and French are maintained
* by the developers. The other languages may be outdated, and any missing string for a langauge

@ -377,6 +377,14 @@ define([
field.focus();
});
var $field = field.tokenfield.closest('.tokenfield').find('.token-input');
$field.on('keypress', function (e) {
if (!$field.val() && e.which === 13) { return void $ok.click(); }
});
$field.on('keydown', function (e) {
if (!$field.val() && e.which === 27) { return void $cancel.click(); }
});
return tagger;
};

@ -46,28 +46,69 @@ define([
return mB + Messages.MB;
};
UIElements.updateTags = function (common, href) {
UIElements.updateTags = function (common, hrefs) {
var existing, tags;
var allTags = {};
if (!hrefs || typeof (hrefs) === "string") {
hrefs = [hrefs];
}
NThen(function(waitFor) {
common.getSframeChannel().query("Q_GET_ALL_TAGS", null, waitFor(function(err, res) {
if (err || res.error) { return void console.error(err || res.error); }
existing = Object.keys(res.tags).sort();
}));
}).nThen(function (waitFor) {
common.getPadAttribute('tags', waitFor(function (err, res) {
if (err) {
if (err === 'NO_ENTRY') {
UI.alert(Messages.tags_noentry);
var _err;
hrefs.forEach(function (href) {
common.getPadAttribute('tags', waitFor(function (err, res) {
if (err) {
if (err === 'NO_ENTRY') {
UI.alert(Messages.tags_noentry);
}
waitFor.abort();
_err = err;
return void console.error(err);
}
waitFor.abort();
return void console.error(err);
}
tags = res || [];
}), href);
allTags[href] = res || [];
if (tags) {
// Intersect with tags from previous pads
tags = (res || []).filter(function (tag) {
return tags.indexOf(tag) !== -1;
});
} else {
tags = res || [];
}
}), href);
});
}).nThen(function () {
UI.dialog.tagPrompt(tags, existing, function (newTags) {
if (!Array.isArray(newTags)) { return; }
common.setPadAttribute('tags', newTags, null, href);
var added = [];
var removed = [];
newTags.forEach(function (tag) {
if (tags.indexOf(tag) === -1) {
added.push(tag);
}
});
tags.forEach(function (tag) {
if (newTags.indexOf(tag) === -1) {
removed.push(tag);
}
});
var update = function (oldTags) {
Array.prototype.push.apply(oldTags, added);
removed.forEach(function (tag) {
var idx = oldTags.indexOf(tag);
oldTags.splice(idx, 1);
});
};
hrefs.forEach(function (href) {
var oldTags = allTags[href] || [];
update(oldTags);
common.setPadAttribute('tags', Util.deduplicateString(oldTags), null, href);
});
});
});
};
@ -1323,6 +1364,7 @@ define([
case 'import':
button = $('<button>', {
'class': 'fa fa-upload cp-toolbar-icon-import',
// XXX text is weird anywhere other than the drive
title: Messages.importButtonTitle,
}).append($('<span>', {'class': 'cp-toolbar-drawer-element'}).text(Messages.importButton));
/*if (data.types) {
@ -1528,6 +1570,7 @@ define([
button = $('<button>', {
title: Messages.printButtonTitle2,
'class': "fa fa-print cp-toolbar-icon-print",
// XXX people don't realize this does PDF (https://github.com/xwiki-labs/cryptpad/issues/357#issuecomment-640711724)
}).append($('<span>', {'class': 'cp-toolbar-drawer-element'}).text(Messages.printText));
break;
case 'history':
@ -1658,6 +1701,7 @@ define([
var drawerCls = data.drawer === false ? '' : '.cp-toolbar-drawer-element';
var icon = data.icon || "fa-question";
button = $(h('button', {
title: data.tippy || ''
//title: data.title || '',
}, [
h('i.fa.' + icon),

@ -526,6 +526,8 @@ define([
}
});
});
return $(menu);
};
@ -919,6 +921,11 @@ define([
if (e.ctrlKey) { ev.ctrlKey = true; }
if (e.shiftKey) { ev.shiftKey = true; }
// ESC
if (e.which === 27) {
return void APP.hideMenu();
}
// Enter
if (e.which === 13) {
var $allSelected = $content.find('.cp-app-drive-element.cp-app-drive-element-selected');
@ -1090,7 +1097,7 @@ define([
var priv = metadataMgr.getPrivateData();
var useUnsafe = Util.find(priv, ['settings', 'security', 'unsafeLinks']);
if (useUnsafe !== false) { // true of undefined: use unsafe links
if (useUnsafe === true) {
return void window.open(APP.origin + href);
}
@ -1294,7 +1301,6 @@ define([
hide.push('properties', 'access');
hide.push('rename');
hide.push('openparent');
hide.push('hashtag');
hide.push('download');
hide.push('share');
hide.push('savelocal');
@ -1309,6 +1315,7 @@ define([
if (!APP.loggedIn) {
hide.push('openparent');
hide.push('rename');
}
filter = function ($el, className) {
@ -4370,12 +4377,12 @@ define([
});
}
else if ($this.hasClass("cp-app-drive-context-hashtag")) {
if (paths.length !== 1) { return; }
el = manager.find(paths[0].path);
data = manager.getFileData(el);
if (!data) { return void console.error("Expected to find a file"); }
var href = data.href || data.roHref;
common.updateTags(href);
var hrefs = paths.map(function (p) {
var el = manager.find(p.path);
var data = manager.getFileData(el);
return data.href || data.roHref;
}).filter(Boolean);
common.updateTags(hrefs);
}
else if ($this.hasClass("cp-app-drive-context-empty")) {
if (paths.length !== 1 || !paths[0].element

@ -874,7 +874,7 @@ define([
// Use hidden hash if needed (we're an owner of this pad so we know it is stored)
var useUnsafe = Util.find(priv, ['settings', 'security', 'unsafeLinks']);
var href = (priv.readOnly && data.roHref) ? data.roHref : data.href;
if (useUnsafe === false) {
if (useUnsafe !== true) {
var newParsed = Hash.parsePadUrl(href);
var newSecret = Hash.getSecrets(newParsed.type, newParsed.hash, newPass);
var newHash = Hash.getHiddenHashFromKeys(parsed.type, newSecret, {});

@ -26,6 +26,17 @@ define([
// Cache of the avatars outer html (including <media-tag>)
var avatars = {};
MT.getMediaTag = function (common, data) {
var metadataMgr = common.getMetadataMgr();
var privateDat = metadataMgr.getPrivateData();
var origin = privateDat.fileHost || privateDat.origin;
var src = data.src = data.src.slice(0,1) === '/' ? origin + data.src : data.src;
return h('media-tag', {
src: src,
'data-crypto-key': 'cryptpad:'+data.key
});
};
MT.getCursorAvatar = function (cursor) {
var html = '<span class="cp-cursor-avatar">';
html += (cursor.avatar && avatars[cursor.avatar]) || '';

@ -7,9 +7,10 @@ define([
'/common/cryptget.js',
'/common/outer/mailbox.js',
'/customize/messages.js',
'/common/common-realtime.js',
'/bower_components/nthen/index.js',
'/bower_components/chainpad-crypto/crypto.js',
], function (AppConfig, Feedback, Hash, Util, Messaging, Crypt, Mailbox, Messages, nThen, Crypto) {
], function (AppConfig, Feedback, Hash, Util, Messaging, Crypt, Mailbox, Messages, Realtime, nThen, Crypto) {
// Start migration check
// Versions:
// 1: migrate pad attributes
@ -456,6 +457,37 @@ define([
if (version < 10) {
fixTodo();
}
}).nThen(function (waitFor) {
if (version >= 11) { return; }
// Migration 11: alert users of safe links as the new default
var done = function () {
Feedback.send('Migrate-11', true);
userObject.version = version = 11;
};
/* userObject.settings.security.unsafeLinks
undefined => the user has never touched it
false => the user has explicitly enabled "safe links"
true => the user has explicitly disabled "safe links"
*/
var unsafeLinks = Util.find(userObject, [ 'settings', 'security', 'unsafeLinks' ]);
if (unsafeLinks !== undefined) { return void done(); }
var ctx = {
store: store,
};
var myData = Messaging.createData(userObject);
Mailbox.sendTo(ctx, 'SAFE_LINKS_DEFAULT', {
user: myData,
}, {
channel: myData.notifications,
curvePublic: myData.curvePublic
}, waitFor(function (obj) {
if (obj && obj.error) { return void console.error(obj); }
done();
}));
/*}).nThen(function (waitFor) {
// Test progress bar in the loading screen
var i = 0;
@ -467,7 +499,7 @@ define([
}, 500);
progress(0, 0);*/
}).nThen(function () {
setTimeout(cb);
Realtime.whenRealtimeSyncs(store.realtime, Util.bake(cb));
});
};
});

@ -387,6 +387,21 @@ define([
}
};
handlers['SAFE_LINKS_DEFAULT'] = function (common, data) {
Messages.settings_safeLinkDefault = "SAFE LINKS ARE NOW DEFAULT"; // XXX
var content = data.content;
content.getFormatText = function () {
return Messages.settings_safeLinkDefault;
};
content.handler = function () {
common.openURL('/settings/#security');
};
if (!content.archived) {
content.dismissHandler = defaultDismiss(common, data);
}
};
// NOTE: don't forget to fixHTML everything returned by "getFormatText"

@ -271,7 +271,7 @@ define([
var checkDrawings = function () {
var editor = getEditor();
if (!editor) { return false; }
if (!editor || !editor.GetSheets) { return false; }
var s = editor.GetSheets();
return s.some(function (obj) {
return obj.worksheet.Drawings.length;
@ -775,6 +775,7 @@ define([
}
// Send the changes
content.locks = content.locks || {};
rtChannel.sendMsg({
type: "saveChanges",
changes: parseChanges(obj.changes),

@ -41,6 +41,9 @@ define([
pad: {
width: true
},
security: {
unsafeLinks: false
},
general: {
allowUserFeedback: true
}

@ -515,6 +515,12 @@ define([
cb();
};
handlers["SAFE_LINKS_DEFAULT"] = function (ctx, box, data, cb) { // XXX
var curve = ctx.store.proxy.curvePublic;
if (data.msg.author !== curve) { return void cb(true); }
cb();
};
// Hide duplicates when receiving a SHARE_PAD notification:
// Keep only one notification per channel: the stronger and more recent one
var comments = {};

@ -823,7 +823,7 @@ define([
var opts = parsed.getOptions();
var hash = Utils.Hash.getHiddenHashFromKeys(parsed.type, secret, opts);
var useUnsafe = Utils.Util.find(settings, ['security', 'unsafeLinks']);
if (useUnsafe === false && window.history && window.history.replaceState) {
if (useUnsafe !== true && window.history && window.history.replaceState) {
if (!/^#/.test(hash)) { hash = '#' + hash; }
window.history.replaceState({}, window.document.title, hash);
}
@ -854,6 +854,7 @@ define([
path: initialPathInDrive, // Where to store the pad if we don't have it in our drive
forceSave: true
};
// XXX copypaste from above...
Cryptpad.setPadTitle(data, function (err) {
if (!err && !(obj && obj.notStored)) {
// No error and the pad was correctly stored
@ -861,7 +862,7 @@ define([
var opts = parsed.getOptions();
var hash = Utils.Hash.getHiddenHashFromKeys(parsed.type, secret, opts);
var useUnsafe = Utils.Util.find(settings, ['security', 'unsafeLinks']);
if (useUnsafe === false && window.history && window.history.replaceState) {
if (useUnsafe !== true && window.history && window.history.replaceState) {
if (!/^#/.test(hash)) { hash = '#' + hash; }
window.history.replaceState({}, window.document.title, hash);
}
@ -1115,7 +1116,13 @@ define([
if (parsed.hashData) { currentPad.hash = parsed.hashData.getHash(opts); }
// Rendered (maybe hidden) hash
var hiddenParsed = Utils.Hash.parsePadUrl(window.location.href);
// Update the hash in the address bar
var ohc = window.onhashchange;
window.onhashchange = function () {};
window.location.href = hiddenParsed.getUrl(opts);
window.onhashchange = ohc;
ohc({reset: true});
});

@ -106,6 +106,7 @@ define([
funcs.addMentions = callWithCommon(UIElements.addMentions);
funcs.importMediaTagMenu = callWithCommon(MT.importMediaTagMenu);
funcs.getMediaTagPreview = callWithCommon(MT.getMediaTagPreview);
funcs.getMediaTag = callWithCommon(MT.getMediaTag);
// Thumb
funcs.displayThumbnail = callWithCommon(Thumb.displayThumbnail);

@ -255,9 +255,9 @@ define([
text: '',
name: 'burn-anon-drive',
icon: 'fa-ban',
title: Messages.fm_burnThisDriveButton,
tippy: Messages.fm_burnThisDriveButton,
drawer: false
}).click(function () {
}, function () {
UI.confirm(Messages.fm_burnThisDrive, function (yes) {
if (!yes) { return; }
common.getSframeChannel().event('EV_BURN_ANON_DRIVE');

@ -277,13 +277,19 @@
border: 1px solid fade(@cryptpad_text_col, 70%);
color: fade(@cryptpad_text_col, 70%);
border-radius: 0px;
font-size: 20px;
font-size: 25px;
display: inline-flex;
justify-content: center;
align-items: center;
line-height: 1;
cursor: pointer;
height: 40px;
&:first-child {
margin-right: 5px;
}
&:last-child {
margin-left: 5px;
}
&:hover {
background-color: rgba(0,0,0,0.1);
}
@ -460,12 +466,14 @@
width: 300px;
margin: 10px 5px;
border: 1px solid @cryptpad_text_col;
color: @cryptpad_text_col;
height: 40px;
display: inline-flex;
justify-content: center;
align-items: center;
align-self: flex-start;
font-size: 40px;
font-size: 25px;
line-height: 100%;
cursor: pointer;
.tools_unselectable();
&:hover {

@ -107,7 +107,7 @@ define([
boardContainerOuter.appendChild(boardContainer);
var addBoard = document.createElement('div');
addBoard.id = 'kanban-addboard';
addBoard.innerText = '+';
addBoard.innerHTML = '<i class="fa fa-plus"></i>';
boardContainer.appendChild(addBoard);
var trash = self.trashContainer = document.createElement('div');
trash.setAttribute('id', 'kanban-trash');
@ -675,17 +675,15 @@ define([
var footerBoard = document.createElement('footer');
footerBoard.classList.add('kanban-board-footer');
//add button
Messages.kanban_addTopButton = '<i class="fa fa-plus"></i> (top)'; // XXX
Messages.kanban_addBottomButton = '<i class="fa fa-plus"></i> (bottom)'; // XXX
var addTopBoardItem = document.createElement('span');
addTopBoardItem.classList.add('kanban-title-button');
addTopBoardItem.setAttribute('data-top', "1");
addTopBoardItem.innerHTML = Messages.kanban_addTopButton;
addTopBoardItem.innerHTML = '<i class="cptools cptools-add-top">';
footerBoard.appendChild(addTopBoardItem);
__onAddItemClickHandler(addTopBoardItem);
var addBoardItem = document.createElement('span');
addBoardItem.classList.add('kanban-title-button');
addBoardItem.innerHTML = Messages.kanban_addBottomButton;
addBoardItem.innerHTML = '<i class="cptools cptools-add-bottom">';
footerBoard.appendChild(addBoardItem);
__onAddItemClickHandler(addBoardItem);

@ -1,5 +1,19 @@
CKEDITOR.dialog.add('mediatag', function (editor) {
var Messages = CKEDITOR._mediatagTranslations;
var isReadOnly = function (el) {
if (!el) { return; }
var parent = el;
while (parent) {
if (parent.nodeName.toUpperCase() === 'BODY') {
// I'm not sure why "false" is a string and not a boolean here
// but that's how it is and I'm scared to touch it
// --ansuz
return parent.getAttribute("contenteditable") === 'false';
}
parent = parent.parentElement;
}
};
return {
title: Messages.title,
minWidth: 400,
@ -118,6 +132,14 @@ CKEDITOR.dialog.add('mediatag', function (editor) {
update();
});
// disable all of the dialog's inputs if it is opened while in read-only mode
if (isReadOnly(element && element.$)) {
Array.prototype.slice.call(inputs).forEach(function (node) {
node.setAttribute('disabled', true);
});
return;
}
setTimeout(update);
},
onOk: function() {

@ -376,6 +376,7 @@ define([
todo();
});
var $upButton = common.createButton('upload', false, data);
$upButton.removeProp('title');
$upButton.text(Messages.profile_upload);
$upButton.prepend($('<span>', {'class': 'fa fa-upload'}));
$block.append($upButton);

@ -177,7 +177,7 @@ define([
});
// If file, display the upload button
if (types.indexOf('file') !== -1 && common.isLoggedIn()) {
if (types.indexOf('file') !== -1) {
var f = (filters && filters.filter) || {};
delete data.accept;
if (Array.isArray(f.fileType)) {
@ -188,7 +188,13 @@ define([
return val;
});
}
$filter.append(common.createButton('upload', false, data));
}
var $uploadButton = common.createButton('upload', false, data);
$filter.append($uploadButton);
if (!common.isLoggedIn()) {
$uploadButton.prop('disabled', true)
.prop('title', Messages.upload_mustLogin);
}
var $container = $(h('span.cp-filepicker-content', [

@ -12,12 +12,13 @@
@color: @colortheme_slide-color
);
@slide-default-bg: #e3e3e3;
// body
font-size: unset;
display: flex;
flex-flow: column;
@slide-default-bg: #000;
.size (@n) {
// font-size: @n * 1vmin;
// line-height: @n * 1.1vmin;
@ -124,7 +125,7 @@
&> img {
width: 50vw;
height: 28.125vw;
max-height: ~"calc(100vh - 96px)";
max-height: ~"calc(100vh - 96px)" !important;
max-width: ~"calc(16 / 9 * (100vh - 96px))";
position: absolute;
left: 0;
@ -163,6 +164,14 @@
#cp-app-slide-editor-container {
display: none;
}
#cp-app-slide-print {
.cp-app-slide-frame {
pre.mermaid > svg {
height: 100%;
width: 100%;
}
}
}
}
#cp-app-slide-print {
position: relative;
@ -331,6 +340,14 @@
line-height: 1em;
}
}
svg {
* {
max-width: unset;
max-height: unset;
line-height: unset;
font-size: 87.5%;
}
}
ul, ol {
ul, ol {
margin: 0;

@ -130,7 +130,6 @@ define([
// Flag to check if a file from the filepicker is a mediatag for the slides or a background image
var Background = {
isBackground: false
};
var mkSlideOptionsButton = function (framework, slideOptions) {
@ -208,7 +207,6 @@ define([
style: 'font-size: 17px',
id: 'cp-app-slide-options-bg'
}).click(function () {
Background.isBackground = true;
var pickerCfg = {
types: ['file'],
where: ['root'],
@ -216,7 +214,12 @@ define([
fileType: ['image/']
}
};
common.openFilePicker(pickerCfg);
common.openFilePicker(pickerCfg, function (data) {
if (data.type === 'file') {
data.mt = common.getMediaTag(data).outerHTML;
Background.todo(data);
}
});
}).text(Messages.printBackgroundButton).appendTo($p);
}
$p.append($('<br>'));
@ -330,7 +333,7 @@ define([
});
};
var mkColorConfiguration = function (framework, $modal) {
var mkColorConfiguration = function (framework, $modal, slideOptions) {
var textColor;
var backColor;
var metadataMgr = framework._.cpNfInner.metadataMgr;
@ -341,11 +344,13 @@ define([
$modal.css('color', text);
$modal.css('border-color', text);
$('#' + SLIDE_COLOR_ID).find('i').css('color', text);
slideOptions.textColor = text;
}
if (back) {
backColor = back;
$modal.css('background-color', back);
$modal.find('.cp-app-slide-frame').css('background-color', back);
$('#' + SLIDE_BACKCOLOR_ID).find('i').css('color', back);
slideOptions.bgColor = back;
}
};
var updateLocalColors = function (text, back) {
@ -357,6 +362,10 @@ define([
framework.localChange();
};
var $check = $("#cp-app-slide-colorpicker");
var $backgroundPicker = $('<input>', { type: 'color', value: backColor })
.css({ display: 'none', })
.on('change', function() { updateLocalColors(undefined, this.value); });
var $back = framework._.sfCommon.createButton(null, true, {
icon: 'fa-square',
text: Messages.slide_backCol,
@ -364,7 +373,14 @@ define([
hiddenReadOnly: true,
name: 'background',
id: SLIDE_BACKCOLOR_ID
}, function () {
$backgroundPicker.val(backColor);
$backgroundPicker.click();
});
var $foregroundPicker = $('<input>', { type: 'color', value: textColor })
.css({ display: 'none', })
.on('change', function() { updateLocalColors(this.value, undefined); });
var $text = framework._.sfCommon.createButton(null, true, {
icon: 'fa-i-cursor',
text: Messages.slide_textCol,
@ -372,28 +388,15 @@ define([
hiddenReadOnly: true,
name: 'color',
id: SLIDE_COLOR_ID
}, function () {
$foregroundPicker.val(textColor);
$foregroundPicker.click();
});
var $testColor = $('<input>', { type: 'color', value: '!' });
var $check = $("#cp-app-slide-colorpicker");
if ($testColor.attr('type') !== "color" || $testColor.val() === '!') { return; }
var $backgroundPicker = $('<input>', { type: 'color', value: backColor })
.css({ display: 'none', })
.on('change', function() { updateLocalColors(undefined, this.value); });
$check.append($backgroundPicker);
$back.on('click', function() {
$backgroundPicker.val(backColor);
$backgroundPicker.click();
});
var $foregroundPicker = $('<input>', { type: 'color', value: textColor })
.css({ display: 'none', })
.on('change', function() { updateLocalColors(this.value, undefined); });
$check.append($foregroundPicker);
$text.on('click', function() {
$foregroundPicker.val(textColor);
$foregroundPicker.click();
});
framework._.toolbar.$theme.append($text).append($back);
@ -403,18 +406,14 @@ define([
updateLocalColors(md.color, md.backColor);
}
});
return {
updateLocalColors: updateLocalColors
};
};
var mkFilePicker = function (framework, editor) {
framework.setMediaTagEmbedder(function (mt, data) {
if (Background.isBackground) {
if (data.type === 'file') {
data.mt = mt[0].outerHTML;
Background.todo(data);
}
Background.isBackground = false;
return;
}
framework.setMediaTagEmbedder(function (mt) {
editor.replaceSelection($(mt)[0].outerHTML);
});
};
@ -473,7 +472,7 @@ define([
mkThemeButton(framework);
mkPrintButton(framework, editor, $content, $print);
mkSlideOptionsButton(framework, slideOptions, $toolbarDrawer);
mkColorConfiguration(framework, $modal);
var colors = mkColorConfiguration(framework, $modal, slideOptions);
mkFilePicker(framework, editor);
mkSlidePreviewPane(framework, $contentContainer);
@ -518,9 +517,15 @@ define([
return CodeMirror.getHeadingText();
});
framework.onReady(function (/*newPad*/) {
framework.onReady(function (newPad) {
editor.focus();
if (newPad) {
colors.updateLocalColors('#000', '#FFF');
} else {
colors.updateLocalColors('#FFF', '#000');
}
CodeMirror.setMode('markdown', function () { });
Slide.onChange(function (o, n, l) {
var slideNumber = '';

@ -93,7 +93,11 @@ define([
if (options.background && options.background.mt) {
mediatagBg = options.background.mt;
}
var m = '<span class="cp-app-slide-container">' + mediatagBg + '<span class="'+slideClass+'">'+DiffMd.render(c).replace(separatorReg, '</span></span><span class="cp-app-slide-container">' + mediatagBg + '<span class="'+slideClass+'">')+'</span></span>';
var bgColor = '';
if (options.bgColor && !mediatagBg) {
bgColor = 'style="background-color:'+options.bgColor+';"';
}
var m = '<span class="cp-app-slide-container">' + mediatagBg + '<span class="'+slideClass+'" '+bgColor+'>'+DiffMd.render(c).replace(separatorReg, '</span></span><span class="cp-app-slide-container">' + mediatagBg + '<span class="'+slideClass+'" '+bgColor+'>')+'</span></span>';
try { DiffMd.apply(m, $content, Common); } catch (e) { return console.error(e); }

@ -17,5 +17,13 @@
display: flex;
flex-flow: column;
.cp-support-language-list {
.cp-support-language {
margin-left: 5px;
background-color: rgba(0, 0, 0, 0.1);
padding: 0 5px;
}
}
}

@ -11,6 +11,7 @@ define([
'/common/hyperscript.js',
'/support/ui.js',
'/api/config',
'/customize/application_config.js',
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
@ -27,7 +28,8 @@ define([
Messages,
h,
Support,
ApiConfig
ApiConfig,
AppConfig
)
{
var APP = window.APP = {};
@ -41,6 +43,7 @@ define([
'cp-support-list',
],
'new': [
'cp-support-language',
'cp-support-form',
],
};
@ -132,6 +135,30 @@ define([
return $div;
};
create['language'] = function () {
if (!Array.isArray(AppConfig.supportLanguages)) { return $(h('div')); }
var languages = AppConfig.supportLanguages;
var list = h('span.cp-support-language-list', languages
.map(function (lang) {
return Messages._languages[lang];
})
.filter(Boolean)
.map(function (lang) {
return h('span.cp-support-language', lang);
})
);
Messages.support_languagesPreamble = "This server's administrators speak the following languages:"; // XXX
var $div = $(
h('div.cp-support-language', [
Messages.support_languagesPreamble,
list,
])
);
return $div;
};
// Create a new tickets
create['form'] = function () {
var key = 'form';

@ -173,7 +173,7 @@ define([
classes: 'btn-danger'
}, function() {
if (typeof(onHide) !== "function") { return; }
onHide(hide); // XXX
onHide(hide);
});
$(answer).click(function () {

@ -220,6 +220,7 @@
width: 100%;
padding: 12px;
margin-bottom: 20px;
white-space: pre;
}
.cp-teams-invite-password {
margin-bottom: 20px;

@ -987,6 +987,7 @@ define([
});
});
var $upButton = common.createButton('upload', false, data);
$upButton.removeProp('title');
$upButton.text(Messages.profile_upload);
$upButton.prepend($('<span>', {'class': 'fa fa-upload'}));

@ -104,6 +104,8 @@ define([
};
SFCommonO.start({
getSecrets: getSecrets,
hash: hash,
href: href,
noHash: true,
noRealtime: true,
//driveEvents: true,

Loading…
Cancel
Save