Merge branch 'soon'
This commit is contained in:
@@ -82,11 +82,9 @@ define([
|
||||
};
|
||||
var mkHelpMenu = function (framework) {
|
||||
var $codeMirrorContainer = $('#cp-app-code-container');
|
||||
var helpMenu = framework._.sfCommon.createHelpMenu();
|
||||
var helpMenu = framework._.sfCommon.createHelpMenu(['text', 'code']);
|
||||
$codeMirrorContainer.prepend(helpMenu.menu);
|
||||
|
||||
$(helpMenu.text).html(DiffMd.render(Messages.codeInitialState));
|
||||
|
||||
framework._.toolbar.$drawer.append(helpMenu.button);
|
||||
};
|
||||
var mkPreviewPane = function (editor, CodeMirror, framework, isPresentMode) {
|
||||
|
||||
@@ -464,6 +464,7 @@ define([
|
||||
var AppConfig = common.getAppConfig();
|
||||
var button;
|
||||
var sframeChan = common.getSframeChannel();
|
||||
var appType = (common.getMetadataMgr().getMetadata().type || 'pad').toUpperCase();
|
||||
switch (type) {
|
||||
case 'export':
|
||||
button = $('<button>', {
|
||||
@@ -656,8 +657,7 @@ define([
|
||||
case 'toggle':
|
||||
button = $('<button>', {
|
||||
'class': 'fa fa-caret-down cp-toolbar-icon-toggle',
|
||||
})
|
||||
.click(common.prepareFeedback(type));
|
||||
});
|
||||
window.setTimeout(function () {
|
||||
button.attr('title', data.title);
|
||||
});
|
||||
@@ -666,14 +666,16 @@ define([
|
||||
if (!isVisible) { button.addClass('fa-caret-down'); }
|
||||
else { button.addClass('fa-caret-up'); }
|
||||
};
|
||||
button.click(function () {
|
||||
button.click(function (e) {
|
||||
data.element.toggle();
|
||||
var isVisible = data.element.is(':visible');
|
||||
if (callback) { callback(isVisible); }
|
||||
if (isVisible) {
|
||||
button.addClass('cp-toolbar-button-active');
|
||||
if (e.originalEvent) { Feedback.send('TOGGLE_SHOW_' + appType); }
|
||||
} else {
|
||||
button.removeClass('cp-toolbar-button-active');
|
||||
if (e.originalEvent) { Feedback.send('TOGGLE_HIDE_' + appType); }
|
||||
}
|
||||
updateIcon(isVisible);
|
||||
});
|
||||
@@ -702,7 +704,7 @@ define([
|
||||
button = $('<button>', {
|
||||
'class': "fa " + icon,
|
||||
})
|
||||
.click(common.prepareFeedback(type));
|
||||
.click(common.prepareFeedback(data.name || 'DEFAULT'));
|
||||
if (data.title) { button.attr('title', data.title); }
|
||||
if (data.style) { button.attr('style', data.style); }
|
||||
if (data.id) { button.attr('id', data.id); }
|
||||
@@ -850,6 +852,7 @@ define([
|
||||
var tbState = true;
|
||||
common.getAttribute(['general', 'markdown-help'], function (e, data) {
|
||||
if (e) { return void console.error(e); }
|
||||
if ($(window).height() < 800) { return; }
|
||||
if (data === true && $toolbarButton.length && tbState) {
|
||||
$toolbarButton.click();
|
||||
}
|
||||
@@ -866,6 +869,7 @@ define([
|
||||
}
|
||||
common.getAttribute(['general', 'markdown-help'], function (e, data) {
|
||||
if (e) { return void console.error(e); }
|
||||
if ($(window).height() < 800) { return; }
|
||||
if (data === true && $toolbarButton) {
|
||||
// Show the toolbar using the button to make sure the icon in the button is
|
||||
// correct (caret-down / caret-up)
|
||||
@@ -886,10 +890,49 @@ define([
|
||||
};
|
||||
};
|
||||
|
||||
UIElements.createHelpMenu = function (common) {
|
||||
UIElements.createHelpMenu = function (common, categories) {
|
||||
var type = common.getMetadataMgr().getMetadata().type || 'pad';
|
||||
|
||||
var text = h('p.cp-help-text');
|
||||
var setHTML = function (e, html) {
|
||||
e.innerHTML = html;
|
||||
return e;
|
||||
};
|
||||
|
||||
var elements = [];
|
||||
if (Messages.help && Messages.help.generic) {
|
||||
Object.keys(Messages.help.generic).forEach(function (el) {
|
||||
elements.push(setHTML(h('li'), Messages.help.generic[el]));
|
||||
});
|
||||
}
|
||||
if (categories) {
|
||||
categories.forEach(function (cat) {
|
||||
var msgs = Messages.help[cat];
|
||||
if (msgs) {
|
||||
Object.keys(msgs).forEach(function (el) {
|
||||
elements.push(setHTML(h('li'), msgs[el]));
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var text = h('p.cp-help-text', [
|
||||
h('h1', Messages.help.title),
|
||||
h('ul', elements)
|
||||
]);
|
||||
|
||||
var origin = common.getMetadataMgr().getPrivateData().origin || '';
|
||||
$(text).find('a').click(function (e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
var href = $(this).attr('href');
|
||||
var absolute = /^https?:\/\//i;
|
||||
if (!absolute.test(href)) {
|
||||
if (href.slice(0,1) !== '/') { href = '/' + href; }
|
||||
href = origin + href;
|
||||
}
|
||||
common.openUnsafeURL(href);
|
||||
});
|
||||
|
||||
var closeButton = h('span.cp-help-close.fa.fa-window-close');
|
||||
var $toolbarButton = common.createButton('', true, {
|
||||
title: Messages.hide_help_button,
|
||||
@@ -921,6 +964,7 @@ define([
|
||||
});
|
||||
|
||||
common.getAttribute(['hideHelp', type], function (err, val) {
|
||||
if ($(window).height() < 800) { return void toggleHelp(true); }
|
||||
if (val === true) { toggleHelp(true); }
|
||||
});
|
||||
|
||||
@@ -1799,6 +1843,7 @@ define([
|
||||
};
|
||||
|
||||
// Owned pads
|
||||
// Default is Owned pad
|
||||
var owned = h('div.cp-creation-owned', [
|
||||
h('h2', [
|
||||
Messages.creation_ownedTitle,
|
||||
@@ -1824,7 +1869,7 @@ define([
|
||||
]);
|
||||
$creation.append(owned);
|
||||
|
||||
// If set to "open pad" or not set, check "open pad"
|
||||
// If set to "open pad", check "open pad"
|
||||
if (!cfg.owned && typeof cfg.owned !== "undefined") {
|
||||
$creation.find('#cp-creation-owned-false').attr('checked', true);
|
||||
}
|
||||
@@ -1872,6 +1917,16 @@ define([
|
||||
])
|
||||
]);
|
||||
$creation.append(expire);
|
||||
$creation.find('#cp-creation-expire-val').keydown(function (e) {
|
||||
if (e.which === 9) {
|
||||
e.stopPropagation();
|
||||
}
|
||||
});
|
||||
$creation.find('#cp-creation-expire-unit').keydown(function (e) {
|
||||
if (e.which === 9 && e.shiftKey) {
|
||||
e.stopPropagation();
|
||||
}
|
||||
});
|
||||
|
||||
UIElements.setExpirationValue(cfg.expire, $creation);
|
||||
|
||||
@@ -1940,6 +1995,7 @@ define([
|
||||
});
|
||||
|
||||
var $button = $('<button>').text(Messages.creation_createFromScratch).appendTo($create);
|
||||
$button.addClass('cp-creation-button-selected');
|
||||
$button.click(function () {
|
||||
create();
|
||||
});
|
||||
@@ -1980,7 +2036,7 @@ define([
|
||||
$spinner[0]
|
||||
])).appendTo($creation);
|
||||
|
||||
var selected = -1;
|
||||
var selected = 0;
|
||||
var next = function () {
|
||||
selected = ++selected % $creation.find('button').length;
|
||||
$creation.find('button').removeClass('cp-creation-button-selected');
|
||||
|
||||
@@ -116,7 +116,7 @@ define([
|
||||
} else {
|
||||
var errText = "[cursor.fixSelection] At least one of the " +
|
||||
"cursor nodes did not exist, could not fix selection";
|
||||
console.error(errText);
|
||||
//console.error(errText);
|
||||
return errText;
|
||||
}
|
||||
} catch (e) { console.error(e); }
|
||||
|
||||
@@ -325,11 +325,11 @@ define([
|
||||
var onConnectionChange = function (info) {
|
||||
if (state === STATE.DELETED) { return; }
|
||||
stateChange(info.state ? STATE.INITIALIZING : STATE.DISCONNECTED);
|
||||
if (info.state) {
|
||||
/*if (info.state) {
|
||||
UI.findOKButton().click();
|
||||
} else {
|
||||
UI.alert(Messages.common_connectionLost, undefined, true);
|
||||
}
|
||||
}*/
|
||||
};
|
||||
|
||||
var onError = function (err) {
|
||||
|
||||
@@ -400,7 +400,7 @@ define([
|
||||
});
|
||||
show();
|
||||
Common.getAttribute(['toolbar', 'userlist-drawer'], function (err, val) {
|
||||
if (val === false) { return void hide(); }
|
||||
if (val === false || $(window).height() < 800) { return void hide(); }
|
||||
show();
|
||||
});
|
||||
|
||||
@@ -1048,6 +1048,13 @@ define([
|
||||
toolbar.reconnecting = function (/*userId*/) {
|
||||
toolbar.connected = false;
|
||||
if (toolbar.spinner) {
|
||||
var state = -1;
|
||||
var interval = window.setInterval(function () {
|
||||
if (toolbar.connected) { clearInterval(interval); }
|
||||
var dots = Array(state+1).join('.');
|
||||
toolbar.spinner.text(Messages.reconnecting + dots);
|
||||
if (++state > 3) { state = 0; }
|
||||
}, 500);
|
||||
toolbar.spinner.text(Messages.reconnecting);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -237,7 +237,7 @@ define([
|
||||
'tabindex': '-1',
|
||||
'data-icon': faFolder,
|
||||
}, Messages.fc_newfolder)),
|
||||
h('li', h('a.cp-app-drive-context-hashtag.dropdown-item', {
|
||||
h('li', h('a.cp-app-drive-context-hashtag.dropdown-item.cp-app-drive-context-editable', {
|
||||
'tabindex': '-1',
|
||||
'data-icon': faTags,
|
||||
}, Messages.fc_hashtag)),
|
||||
|
||||
@@ -138,11 +138,9 @@ define([
|
||||
|
||||
var mkHelpMenu = function (framework) {
|
||||
var $toolbarContainer = $('.cke_toolbox_main');
|
||||
var helpMenu = framework._.sfCommon.createHelpMenu();
|
||||
var helpMenu = framework._.sfCommon.createHelpMenu(['text', 'pad']);
|
||||
$toolbarContainer.before(helpMenu.menu);
|
||||
|
||||
$(helpMenu.text).html(Messages.initialState);
|
||||
|
||||
framework._.toolbar.$drawer.append(helpMenu.button);
|
||||
};
|
||||
|
||||
@@ -282,7 +280,7 @@ define([
|
||||
framework._.sfCommon.setAttribute(['pad', 'showToolbar'], visible);
|
||||
};
|
||||
framework._.sfCommon.getAttribute(['pad', 'showToolbar'], function (err, data) {
|
||||
if (typeof(data) === "undefined" || data) { $('.cke_toolbox_main').show(); }
|
||||
if ($(window).height() >= 800 && (typeof(data) === "undefined" || data)) { $('.cke_toolbox_main').show(); }
|
||||
else { $('.cke_toolbox_main').hide(); }
|
||||
var $collapse = framework._.sfCommon.createButton('toggle', true, cfg, onClick);
|
||||
framework._.toolbar.$rightside.append($collapse);
|
||||
|
||||
@@ -1117,13 +1117,13 @@ define([
|
||||
});
|
||||
}
|
||||
setEditable(false);
|
||||
UI.alert(Messages.common_connectionLost, undefined, true);
|
||||
//UI.alert(Messages.common_connectionLost, undefined, true);
|
||||
};
|
||||
|
||||
var onReconnect = function () {
|
||||
if (APP.unrecoverable) { return; }
|
||||
setEditable(true);
|
||||
UI.findOKButton().click();
|
||||
//UI.findOKButton().click();
|
||||
};
|
||||
|
||||
var getHeadingText = function () {
|
||||
@@ -1199,19 +1199,9 @@ define([
|
||||
var $export = common.createButton('export', true, {}, exportFile);
|
||||
$drawer.append($export);
|
||||
|
||||
var helpMenu = common.createHelpMenu();
|
||||
var helpMenu = common.createHelpMenu(['poll']);
|
||||
$('#cp-app-poll-form').prepend(helpMenu.menu);
|
||||
$drawer.append(helpMenu.button);
|
||||
var setHTML = function (e, html) {
|
||||
e.innerHTML = html;
|
||||
return e;
|
||||
};
|
||||
var help = h('div', [
|
||||
setHTML(h('h1'), Messages.poll_subtitle),
|
||||
h('p', Messages.poll_p_save),
|
||||
h('p', Messages.poll_p_encryption)
|
||||
]);
|
||||
$(helpMenu.text).html($(help).html());
|
||||
|
||||
if (APP.readOnly) { publish(true); return; }
|
||||
var $publish = common.createButton('', true, {
|
||||
|
||||
@@ -335,13 +335,13 @@ define([
|
||||
type: 'radio',
|
||||
name: 'cp-creation-owned',
|
||||
value: 1,
|
||||
checked: 'checked'
|
||||
}),
|
||||
h('label', { 'for': 'cp-creation-owned-true' }, Messages.creation_ownedTrue),
|
||||
h('input#cp-creation-owned-false.cp-creation-owned-value', {
|
||||
type: 'radio',
|
||||
name: 'cp-creation-owned',
|
||||
value: 0,
|
||||
checked: 'checked'
|
||||
}),
|
||||
h('label', { 'for': 'cp-creation-owned-false' }, Messages.creation_ownedFalse),
|
||||
h('span.fa.fa-check', {title: Messages.saved}),
|
||||
@@ -364,8 +364,8 @@ define([
|
||||
});
|
||||
});
|
||||
common.getAttribute(['general', 'creation', 'owned'], function (e, val) {
|
||||
if (val) {
|
||||
$owned.find('#cp-creation-owned-true').attr('checked', true);
|
||||
if (!val && typeof val !== "undefined") {
|
||||
$owned.find('#cp-creation-owned-false').attr('checked', true);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -432,11 +432,9 @@ define([
|
||||
|
||||
var mkHelpMenu = function (framework) {
|
||||
var $codeMirrorContainer = $('#cp-app-slide-editor-container');
|
||||
var helpMenu = framework._.sfCommon.createHelpMenu();
|
||||
var helpMenu = framework._.sfCommon.createHelpMenu(['text', 'slide']);
|
||||
$codeMirrorContainer.prepend(helpMenu.menu);
|
||||
|
||||
$(helpMenu.text).html(DiffMd.render(Messages.slideInitialState));
|
||||
|
||||
framework._.toolbar.$drawer.append(helpMenu.button);
|
||||
};
|
||||
|
||||
|
||||
@@ -454,13 +454,10 @@ define([
|
||||
var $properties = common.createButton('properties', true);
|
||||
toolbar.$drawer.append($properties);
|
||||
|
||||
if (Messages.whiteboardHelp) {
|
||||
var $appContainer = $('#cp-app-whiteboard-container');
|
||||
var helpMenu = common.createHelpMenu();
|
||||
$appContainer.prepend(helpMenu.menu);
|
||||
$(helpMenu.text).html(Messages.whiteboardHelp);
|
||||
toolbar.$drawer.append(helpMenu.button);
|
||||
}
|
||||
var $appContainer = $('#cp-app-whiteboard-container');
|
||||
var helpMenu = common.createHelpMenu(['whiteboard']);
|
||||
$appContainer.prepend(helpMenu.menu);
|
||||
toolbar.$drawer.append(helpMenu.button);
|
||||
|
||||
if (!readOnly) {
|
||||
makeColorButton($rightside);
|
||||
@@ -616,9 +613,9 @@ define([
|
||||
setEditable(info.state);
|
||||
if (info.state) {
|
||||
initializing = true;
|
||||
UI.findOKButton().click();
|
||||
//UI.findOKButton().click();
|
||||
} else {
|
||||
UI.alert(Messages.common_connectionLost, undefined, true);
|
||||
//UI.alert(Messages.common_connectionLost, undefined, true);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user