Mglaser has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/364676 )
Change subject: BlueSpiceVisualEditor: fixing link editing
......................................................................
BlueSpiceVisualEditor: fixing link editing
Insert links would produce newlines and remove space. This is now
fixed
Change-Id: I466acef30517e128739a1b18e10f280c7f0c5438
---
M InsertLink/resources/bluespice.insertLink.js
M VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js
2 files changed, 14 insertions(+), 22 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceExtensions
refs/changes/76/364676/1
diff --git a/InsertLink/resources/bluespice.insertLink.js
b/InsertLink/resources/bluespice.insertLink.js
index 2c61406..9d51ce4 100644
--- a/InsertLink/resources/bluespice.insertLink.js
+++ b/InsertLink/resources/bluespice.insertLink.js
@@ -218,31 +218,22 @@
data.title ? data.title : data.href
);
- //Workaround for IE when replacing text with a anchor tag
- if( tinymce.Env.ie > 0) {
- var sel = editor.selection.getSel().toString();
- if( sel ) {
- var content = node.innerHTML;
- content = content.replace(sel, newAnchor);
+ // The following code used to be a workaround for IE. Other
browsers used
+ // these lines:
+ // editor.insertContent(newAnchor);
+ // editor.selection.collapse(false);
+ // However, the non-workaround way lead to removal of spaces
after (Chrome)
+ // and before (FF) the link text. The IE code works in all
browsers.
+ var sel = editor.selection.getSel().toString();
+ if( sel ) {
+ var content = node.innerHTML;
+ content = content.replace(sel, newAnchor);
- var newNode = editor.dom.create(
node.nodeName.toLowerCase(), {}, content );
+ var newNode = editor.dom.create(
node.nodeName.toLowerCase(), {}, content );
- editor.dom.replace(newNode, node);
+ editor.dom.replace(newNode, node);
- return;
- }
+ return;
}
-
- editor.insertContent(newAnchor);
- //editor.selection.select(newAnchor, false);
- editor.selection.collapse(false);
- //editor.dom.inserAfter(newAnchor, editor.selection.getSel());
- //editor.selection.getEnd().remove();
- //this.dom.insertAfter(newAnchor, editor.selection.getNode());
-
-
- //Place cursor to new element
- //editor.selection.select(newAnchor, false);
- //editor.selection.collapse(false);
}
};
diff --git a/VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js
b/VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js
index e0d2e50..29d7827 100644
--- a/VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js
+++ b/VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js
@@ -2373,6 +2373,7 @@
//Find button elements with no content and set content to ' ',
to prevent removing
e.content = e.content.replace(/><\/button>/g,
'> </button>');
+ e.content = e.content.replace(/^<p>(.*)<\/p>$/gmi, '$1' );
_loadImageRealUrls();
}
--
To view, visit https://gerrit.wikimedia.org/r/364676
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I466acef30517e128739a1b18e10f280c7f0c5438
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: master
Gerrit-Owner: Mglaser <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits