|
|
@@ -83,6 +83,7 @@ import noMore from './noMore.vue'; |
|
|
|
import scroll from './utils/scroll'; |
|
|
|
import bus from './utils/bus'; |
|
|
|
import EditorUI from './editors/PinEditorUI.vue'; |
|
|
|
import niceLinks from './utils/niceLinks'; |
|
|
|
|
|
|
|
function createImageItem(pin) { |
|
|
|
const image = {}; |
|
|
@@ -126,18 +127,6 @@ function initialData() { |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
const encoder = document.createElement('div'); |
|
|
|
function escapeHTML(text) { |
|
|
|
encoder.innerText = text; |
|
|
|
return encoder.innerHTML; |
|
|
|
} |
|
|
|
|
|
|
|
const reURL = /https?:[/][/](?:www[.])?([^/]+)(?:[/]([.]?[^\s,.<>])+)?/g; |
|
|
|
function niceLinks(text) { |
|
|
|
if (!text) return ''; |
|
|
|
return escapeHTML(text).replace(reURL, '<a href="$&" target="_blank">$1</a>'); |
|
|
|
} |
|
|
|
|
|
|
|
export default { |
|
|
|
name: 'pins', |
|
|
|
components: { |
|
|
|