open in a new window only the absolute paths
parent
5b5f5408a4
commit
83d8eae300
|
@ -25,7 +25,7 @@
|
|||
taiga = @.taiga
|
||||
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 = () ->
|
||||
if window.getSelection
|
||||
if window.getSelection().empty
|
||||
|
@ -404,7 +404,6 @@ Medium = ($translate, $confirm, $storage, wysiwygService, animationFrame, tgLoad
|
|||
editorMedium.html(html)
|
||||
|
||||
mediumInstance = new MediumEditor(editorMedium[0], {
|
||||
targetBlank: true,
|
||||
imageDragging: false,
|
||||
placeholder: {
|
||||
text: $scope.placeholder
|
||||
|
@ -487,10 +486,14 @@ Medium = ($translate, $confirm, $storage, wysiwygService, animationFrame, tgLoad
|
|||
$scope.$applyAsync(throttleChange)
|
||||
|
||||
mediumInstance.subscribe "editableClick", (e) ->
|
||||
e.stopPropagation()
|
||||
r = new RegExp('^(?:[a-z]+:)?//', 'i')
|
||||
|
||||
if e.target.href
|
||||
window.open(e.target.href)
|
||||
if 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) ->
|
||||
$scope.onUploadFile({files: event.dataTransfer.files, cb: uploadEnd})
|
||||
|
@ -593,5 +596,6 @@ angular.module("taigaComponents").directive("tgWysiwyg", [
|
|||
"tgWysiwygCodeHightlighterService",
|
||||
"tgWysiwygMentionService",
|
||||
"$tgAnalytics",
|
||||
"$location",
|
||||
Medium
|
||||
])
|
||||
|
|
|
@ -84,7 +84,10 @@ class WysiwygService
|
|||
link = /\[[^\]]*\]\(([^\)]*)\)/g # [Title-with-spaces](Title with spaces)
|
||||
|
||||
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) ->
|
||||
el = document.createElement( 'html' )
|
||||
|
@ -182,11 +185,10 @@ class WysiwygService
|
|||
|
||||
autoLinkHTML: (html) ->
|
||||
# override Autolink parser
|
||||
|
||||
|
||||
matchRegexStr = String(Autolinker.matcher.Mention.prototype.matcherRegexes.twitter)
|
||||
if matchRegexStr.indexOf('.') == -1
|
||||
matchRegexStr = '@[^\s]{1,50}[^.\s]'
|
||||
#Autolinker.matcher.Mention.prototype.matcherRegexes.twitter = new RegExp(matchRegexStr, 'g')
|
||||
|
||||
autolinker = new Autolinker({
|
||||
mention: 'twitter',
|
||||
|
|
Loading…
Reference in New Issue