jenkins-bot has submitted this change and it was merged.

Change subject: BSInsertFile: add option to insert file on pure text selection
......................................................................


BSInsertFile: add option to insert file on pure text selection

Change-Id: I78f5b68f96963339d7ff616bd0d900a9c7dfd56c
---
M InsertFile/resources/bluespice.insertFile.js
1 file changed, 17 insertions(+), 6 deletions(-)

Approvals:
  Robert Vogel: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/InsertFile/resources/bluespice.insertFile.js 
b/InsertFile/resources/bluespice.insertFile.js
index 2bdbdbc..1179cb2 100644
--- a/InsertFile/resources/bluespice.insertFile.js
+++ b/InsertFile/resources/bluespice.insertFile.js
@@ -18,8 +18,24 @@
                var data = {};
                var selection = bs.util.selection.save();
                if( selection !== '' ) {
+                       var checkIsWikiLink = selection.match(/\[\[.*?\]\]/);
                        var wikiLink = new bs.wikiText.Link( selection );
-                       if( wikiLink.getNsId() !== bs.ns.NS_MEDIA ) {
+
+                       if( checkIsWikiLink === null ){
+                               data = {
+                                       title: selection,
+                                       displayText: selection,
+                                       caption: selection //Same as 
getDisplayText()
+                               };
+                       }
+                       else if( wikiLink.getNsId() === bs.ns.NS_MEDIA ) {
+                               data = {
+                                       title: wikiLink.getTitle(),
+                                       displayText: wikiLink.getDisplayText(),
+                                       caption: wikiLink.getCaption() //Same 
as getDisplayText()
+                               };
+                       }
+                       else {
                                bs.util.alert(
                                        'bs-insertfile-selection-alert',
                                        {
@@ -28,11 +44,6 @@
                                );
                                return;
                        }
-                       data = {
-                               title: wikiLink.getTitle(),
-                               displayText: wikiLink.getDisplayText(),
-                               caption: wikiLink.getCaption() //Same as 
getDisplayText()
-                       };
                }
 
                BS.InsertFile.FileDialog.show( me );

-- 
To view, visit https://gerrit.wikimedia.org/r/297391
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I78f5b68f96963339d7ff616bd0d900a9c7dfd56c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: REL1_23
Gerrit-Owner: Robert Vogel <[email protected]>
Gerrit-Reviewer: Ljonka <[email protected]>
Gerrit-Reviewer: Robert Vogel <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to