Merge branch 'soon' into staging

pull/1/head
ansuz 4 years ago
commit 509ef18a15

@ -1,3 +1,7 @@
# WIP
* merge PR to open links in rich text with a single click
# 4.4.0
## Goals

@ -417,6 +417,9 @@
"settings_padSpellcheckTitle": "Rechtschreibprüfung",
"settings_padSpellcheckHint": "Mit dieser Option kann die Rechtschreibprüfung in Rich-Text-Pads aktiviert werden. Rechtschreibfehler werden rot unterstrichen. Halte die Strg- oder Meta-Taste gedrückt, um Verbesserungsvorschläge anzuzeigen.",
"settings_padSpellcheckLabel": "Rechtschreibprüfung in Rich-Text-Pads aktivieren",
"settings_padOpenLinkTitle": "Links direkt öffnen",
"settings_padOpenLinkHint": "Mit dieser Optione werden externe Links direkt über Klick in einem neuem Fenster geöffnet.",
"settings_padOpenLinkLabel": "Aktiviert Links direkt über Klick zu öffnen",
"settings_ownDriveTitle": "Account aktualisieren",
"settings_ownDriveHint": "Aus technischen Gründen sind nicht alle neue Funktionen für ältere Konten verfügbar. Eine kostenlose Aktualisierung wird die neuen Funktionen aktivieren und dein CryptDrive für zukünftige Aktualisierungen vorbereiten.",
"settings_ownDriveButton": "Upgrade deines Accounts",

@ -434,6 +434,9 @@
"settings_padSpellcheckTitle": "Spellcheck",
"settings_padSpellcheckHint": "This option allows you to enable spellcheck in rich text pads. Spelling errors will be underlined in red and you'll have to hold your Ctrl or Meta key while right-clicking to see the correct options.",
"settings_padSpellcheckLabel": "Enable spell check in rich text pads",
"settings_padOpenLinkTitle": "Open links on first click",
"settings_padOpenLinkHint": "With this option you can open embedded links on click without the preview popup",
"settings_padOpenLinkLabel": "Enable direct link opening rich text pads",
"settings_ownDriveTitle": "Update Account",
"settings_ownDriveHint": "Older accounts do not have access to the latest features, due to technical reasons. A free update will enable current features, and prepare your CryptDrive for future updates.",
"settings_ownDriveButton": "Upgrade your account",

@ -1445,7 +1445,9 @@ define([
editor.setKeystroke( CKEDITOR.CTRL + CKEDITOR.ALT + styleKeys[tag], tag);
});
Links.init(Ckeditor, editor);
var privateData = framework._.cpNfInner.metadataMgr.getPrivateData();
var openLinkSetting = Util.find(privateData, ['settings', 'pad', 'openLink']);
Links.init(Ckeditor, editor, openLinkSetting);
}).nThen(function() {
// Move ckeditor parts to have a structure like the other apps
var $contentContainer = $('#cke_1_contents');

@ -5,7 +5,7 @@ define([
'/customize/messages.js'
], function ($, h, UIElements, Messages) {
var onLinkClicked = function (e, inner) {
var onLinkClicked = function (e, inner, openLinkSetting) {
var $target = $(e.target);
if (!$target.is('a')) {
$target = $target.closest('a');
@ -25,6 +25,13 @@ define([
return;
}
var open = function () {
var bounceHref = window.location.origin + '/bounce/#' + encodeURIComponent(href);
window.open(bounceHref);
};
if (openLinkSetting) { return void open(); }
var $iframe = $('html').find('iframe').contents();
var rect = e.target.getBoundingClientRect();
@ -48,8 +55,7 @@ define([
$(a).click(function (ee) {
ee.preventDefault();
ee.stopPropagation();
var bounceHref = window.location.origin + '/bounce/#' + encodeURIComponent(href);
window.open(bounceHref);
open();
$link.remove();
});
$link.on('mouseleave', function () {
@ -61,7 +67,7 @@ define([
};
return {
init : function (Ckeditor, editor) {
init : function (Ckeditor, editor, openLinkSetting) {
if (!Ckeditor.plugins.link) { return; }
var inner = editor.document.$.body;
@ -70,7 +76,7 @@ define([
$inner.click(function (e) {
removeClickedLink($inner);
if (e.target.nodeName.toUpperCase() === 'A' || $(e.target).closest('a').length) {
return void onLinkClicked(e, inner);
return void onLinkClicked(e, inner, openLinkSetting);
}
});

@ -84,6 +84,7 @@ define([
'cp-settings-pad-width',
'cp-settings-pad-spellcheck',
'cp-settings-pad-notif',
'cp-settings-pad-openlink',
],
'code': [ // Msg.settings_cat_code
'cp-settings-code-indent-unit',
@ -1359,6 +1360,43 @@ define([
cb($cbox);
}, true);
create['pad-openlink'] = function() {
var $div = $('<div>', {
'class': 'cp-settings-pad-openlink cp-sidebarlayout-element'
});
$('<label>').text(Messages.settings_padOpenLinkTitle).appendTo($div);
$('<span>', { 'class': 'cp-sidebarlayout-description' })
.text(Messages.settings_padOpenLinkHint).appendTo($div);
var $ok = $('<span>', { 'class': 'fa fa-check', title: Messages.saved });
var $spinner = $('<span>', { 'class': 'fa fa-spinner fa-pulse' });
var $cbox = $(UI.createCheckbox('cp-settings-pad-openlink',
Messages.settings_padOpenLinkLabel,
false, { label: { class: 'noTitle' } }));
var $checkbox = $cbox.find('input').on('change', function() {
$spinner.show();
$ok.hide();
var val = $checkbox.is(':checked');
common.setAttribute(['pad', 'openLink'], val, function() {
$spinner.hide();
$ok.show();
});
});
$cbox.appendTo($div);
$ok.hide().appendTo($cbox);
$spinner.hide().appendTo($cbox);
common.getAttribute(['pad', 'openLink'], function(e, val) {
if (e) { return void console.error(e); }
if (val) {
$checkbox.attr('checked', 'checked');
}
});
return $div;
};
// Code settings
create['code-indent-unit'] = function() {

Loading…
Cancel
Save