open in a new window only the absolute paths
parent
5b5f5408a4
commit
83d8eae300
|
@ -25,7 +25,7 @@
|
||||||
taiga = @.taiga
|
taiga = @.taiga
|
||||||
bindOnce = @.taiga.bindOnce
|
bindOnce = @.taiga.bindOnce
|
||||||
|
|
||||||
Medium = ($translate, $confirm, $storage, wysiwygService, animationFrame, tgLoader, wysiwygCodeHightlighterService, wysiwygMentionService, analytics) ->
|
Medium = ($translate, $confirm, $storage, wysiwygService, animationFrame, tgLoader, wysiwygCodeHightlighterService, wysiwygMentionService, analytics, $location) ->
|
||||||
removeSelections = () ->
|
removeSelections = () ->
|
||||||
if window.getSelection
|
if window.getSelection
|
||||||
if window.getSelection().empty
|
if window.getSelection().empty
|
||||||
|
@ -404,7 +404,6 @@ Medium = ($translate, $confirm, $storage, wysiwygService, animationFrame, tgLoad
|
||||||
editorMedium.html(html)
|
editorMedium.html(html)
|
||||||
|
|
||||||
mediumInstance = new MediumEditor(editorMedium[0], {
|
mediumInstance = new MediumEditor(editorMedium[0], {
|
||||||
targetBlank: true,
|
|
||||||
imageDragging: false,
|
imageDragging: false,
|
||||||
placeholder: {
|
placeholder: {
|
||||||
text: $scope.placeholder
|
text: $scope.placeholder
|
||||||
|
@ -487,10 +486,14 @@ Medium = ($translate, $confirm, $storage, wysiwygService, animationFrame, tgLoad
|
||||||
$scope.$applyAsync(throttleChange)
|
$scope.$applyAsync(throttleChange)
|
||||||
|
|
||||||
mediumInstance.subscribe "editableClick", (e) ->
|
mediumInstance.subscribe "editableClick", (e) ->
|
||||||
e.stopPropagation()
|
r = new RegExp('^(?:[a-z]+:)?//', 'i')
|
||||||
|
|
||||||
if e.target.href
|
if e.target.href
|
||||||
window.open(e.target.href)
|
if r.test(e.target.getAttribute('href')) || e.target.getAttribute('target') == '_blank'
|
||||||
|
e.stopPropagation()
|
||||||
|
window.open(e.target.href)
|
||||||
|
else
|
||||||
|
$location.url(e.target.href)
|
||||||
|
|
||||||
mediumInstance.subscribe 'editableDrop', (event) ->
|
mediumInstance.subscribe 'editableDrop', (event) ->
|
||||||
$scope.onUploadFile({files: event.dataTransfer.files, cb: uploadEnd})
|
$scope.onUploadFile({files: event.dataTransfer.files, cb: uploadEnd})
|
||||||
|
@ -593,5 +596,6 @@ angular.module("taigaComponents").directive("tgWysiwyg", [
|
||||||
"tgWysiwygCodeHightlighterService",
|
"tgWysiwygCodeHightlighterService",
|
||||||
"tgWysiwygMentionService",
|
"tgWysiwygMentionService",
|
||||||
"$tgAnalytics",
|
"$tgAnalytics",
|
||||||
|
"$location",
|
||||||
Medium
|
Medium
|
||||||
])
|
])
|
||||||
|
|
|
@ -84,7 +84,10 @@ class WysiwygService
|
||||||
link = /\[[^\]]*\]\(([^\)]*)\)/g # [Title-with-spaces](Title with spaces)
|
link = /\[[^\]]*\]\(([^\)]*)\)/g # [Title-with-spaces](Title with spaces)
|
||||||
|
|
||||||
return text.replace link, (match, p1, offset, str) ->
|
return text.replace link, (match, p1, offset, str) ->
|
||||||
return match.replace /\(.*\)/, '(' + taiga.slugify(p1) + ')'
|
if p1.indexOf(' ') >= 0
|
||||||
|
return match.replace /\(.*\)/, '(' + taiga.slugify(p1) + ')'
|
||||||
|
else
|
||||||
|
return match
|
||||||
|
|
||||||
replaceUrls: (html) ->
|
replaceUrls: (html) ->
|
||||||
el = document.createElement( 'html' )
|
el = document.createElement( 'html' )
|
||||||
|
@ -186,7 +189,6 @@ class WysiwygService
|
||||||
matchRegexStr = String(Autolinker.matcher.Mention.prototype.matcherRegexes.twitter)
|
matchRegexStr = String(Autolinker.matcher.Mention.prototype.matcherRegexes.twitter)
|
||||||
if matchRegexStr.indexOf('.') == -1
|
if matchRegexStr.indexOf('.') == -1
|
||||||
matchRegexStr = '@[^\s]{1,50}[^.\s]'
|
matchRegexStr = '@[^\s]{1,50}[^.\s]'
|
||||||
#Autolinker.matcher.Mention.prototype.matcherRegexes.twitter = new RegExp(matchRegexStr, 'g')
|
|
||||||
|
|
||||||
autolinker = new Autolinker({
|
autolinker = new Autolinker({
|
||||||
mention: 'twitter',
|
mention: 'twitter',
|
||||||
|
|
Loading…
Reference in New Issue