Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging
This commit is contained in:
commit
88b29e8bdd
@ -245,7 +245,14 @@ define([
|
|||||||
// Remove the selected 'href' from the tree located at 'path', and push its locations to the 'paths' array
|
// Remove the selected 'href' from the tree located at 'path', and push its locations to the 'paths' array
|
||||||
var removeFileFromRoot = function (path, href) {
|
var removeFileFromRoot = function (path, href) {
|
||||||
var paths = [];
|
var paths = [];
|
||||||
var root = findElement(files, path);
|
var root = exp.findElement(files, path);
|
||||||
|
|
||||||
|
var rememberUnknownPath = function (p) {
|
||||||
|
if (paths.indexOf(p) === -1) {
|
||||||
|
paths.push(p);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if (isFile(root)) { return; }
|
if (isFile(root)) { return; }
|
||||||
for (var e in root) {
|
for (var e in root) {
|
||||||
if (isFile(root[e])) {
|
if (isFile(root[e])) {
|
||||||
@ -259,11 +266,7 @@ define([
|
|||||||
} else {
|
} else {
|
||||||
var nPath = path.slice();
|
var nPath = path.slice();
|
||||||
nPath.push(e);
|
nPath.push(e);
|
||||||
removeFileFromRoot(nPath, href).forEach(function (p) {
|
removeFileFromRoot(nPath, href).forEach(rememberUnknownPath);
|
||||||
if (paths.indexOf(p) === -1) {
|
|
||||||
paths.push(p);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return paths;
|
return paths;
|
||||||
|
|||||||
@ -404,7 +404,7 @@ define([
|
|||||||
var toHide = filterContextMenu($menu, $element);
|
var toHide = filterContextMenu($menu, $element);
|
||||||
$actions = $actions.filter(function (i, el) {
|
$actions = $actions.filter(function (i, el) {
|
||||||
for (var j = 0; j < toHide.length; j++) {
|
for (var j = 0; j < toHide.length; j++) {
|
||||||
if ($(el).is(toHide[j])) { return false; };
|
if ($(el).is(toHide[j])) { return false; }
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|||||||
@ -3,6 +3,20 @@ define(function () {
|
|||||||
// See https://github.com/xwiki-contrib/application-ckeditor/commit/755d193497bf23ed874d874b4ae92fbee887fc10
|
// See https://github.com/xwiki-contrib/application-ckeditor/commit/755d193497bf23ed874d874b4ae92fbee887fc10
|
||||||
return {
|
return {
|
||||||
addSupportForOpeningLinksInNewTab : function (Ckeditor) {
|
addSupportForOpeningLinksInNewTab : function (Ckeditor) {
|
||||||
|
// Returns the DOM element of the active (currently focused) link. It has also support for linked image widgets.
|
||||||
|
// @return {CKEDITOR.dom.element}
|
||||||
|
var getActiveLink = function(editor) {
|
||||||
|
var anchor = Ckeditor.plugins.link.getSelectedLink(editor),
|
||||||
|
// We need to do some special checking against widgets availability.
|
||||||
|
activeWidget = editor.widgets && editor.widgets.focused;
|
||||||
|
// If default way of getting links didn't return anything useful..
|
||||||
|
if (!anchor && activeWidget && activeWidget.name === 'image' && activeWidget.parts.link) {
|
||||||
|
// Since CKEditor 4.4.0 image widgets may be linked.
|
||||||
|
anchor = activeWidget.parts.link;
|
||||||
|
}
|
||||||
|
return anchor;
|
||||||
|
};
|
||||||
|
|
||||||
return function(event) {
|
return function(event) {
|
||||||
var editor = event.editor;
|
var editor = event.editor;
|
||||||
if (!Ckeditor.plugins.link) {
|
if (!Ckeditor.plugins.link) {
|
||||||
@ -39,19 +53,6 @@ define(function () {
|
|||||||
editor.contextMenu._.panelDefinition.css.push('.cke_button__openLink_icon {' +
|
editor.contextMenu._.panelDefinition.css.push('.cke_button__openLink_icon {' +
|
||||||
Ckeditor.skin.getIconStyle('link') + '}');
|
Ckeditor.skin.getIconStyle('link') + '}');
|
||||||
}
|
}
|
||||||
// Returns the DOM element of the active (currently focused) link. It has also support for linked image widgets.
|
|
||||||
// @return {CKEDITOR.dom.element}
|
|
||||||
var getActiveLink = function(editor) {
|
|
||||||
var anchor = Ckeditor.plugins.link.getSelectedLink(editor),
|
|
||||||
// We need to do some special checking against widgets availability.
|
|
||||||
activeWidget = editor.widgets && editor.widgets.focused;
|
|
||||||
// If default way of getting links didn't return anything useful..
|
|
||||||
if (!anchor && activeWidget && activeWidget.name == 'image' && activeWidget.parts.link) {
|
|
||||||
// Since CKEditor 4.4.0 image widgets may be linked.
|
|
||||||
anchor = activeWidget.parts.link;
|
|
||||||
}
|
|
||||||
return anchor;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user