Merge branch 'mentions-with-dots' into new

This commit is contained in:
2022-07-09 15:24:08 +03:00
15 changed files with 298 additions and 145 deletions

View File

@@ -641,6 +641,91 @@ module.exports = function(module) {
};
/***/ }),
/***/ "8875":
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// addapted from the document.currentScript polyfill by Adam Miller
// MIT license
// source: https://github.com/amiller-gh/currentScript-polyfill
// added support for Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1620505
(function (root, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {}
}(typeof self !== 'undefined' ? self : this, function () {
function getCurrentScript () {
var descriptor = Object.getOwnPropertyDescriptor(document, 'currentScript')
// for chrome
if (!descriptor && 'currentScript' in document && document.currentScript) {
return document.currentScript
}
// for other browsers with native support for currentScript
if (descriptor && descriptor.get !== getCurrentScript && document.currentScript) {
return document.currentScript
}
// IE 8-10 support script readyState
// IE 11+ & Firefox support stack trace
try {
throw new Error();
}
catch (err) {
// Find the second match for the "at" string to get file src url from stack.
var ieStackRegExp = /.*at [^(]*\((.*):(.+):(.+)\)$/ig,
ffStackRegExp = /@([^@]*):(\d+):(\d+)\s*$/ig,
stackDetails = ieStackRegExp.exec(err.stack) || ffStackRegExp.exec(err.stack),
scriptLocation = (stackDetails && stackDetails[1]) || false,
line = (stackDetails && stackDetails[2]) || false,
currentLocation = document.location.href.replace(document.location.hash, ''),
pageSource,
inlineScriptSourceRegExp,
inlineScriptSource,
scripts = document.getElementsByTagName('script'); // Live NodeList collection
if (scriptLocation === currentLocation) {
pageSource = document.documentElement.outerHTML;
inlineScriptSourceRegExp = new RegExp('(?:[^\\n]+?\\n){0,' + (line - 2) + '}[^<]*<script>([\\d\\D]*?)<\\/script>[\\d\\D]*', 'i');
inlineScriptSource = pageSource.replace(inlineScriptSourceRegExp, '$1').trim();
}
for (var i = 0; i < scripts.length; i++) {
// If ready state is interactive, return the script tag
if (scripts[i].readyState === 'interactive') {
return scripts[i];
}
// If src matches, return the script tag
if (scripts[i].src === scriptLocation) {
return scripts[i];
}
// If inline source matches, return the script tag
if (
scriptLocation === currentLocation &&
scripts[i].innerHTML &&
scripts[i].innerHTML.trim() === inlineScriptSource
) {
return scripts[i];
}
}
// If no match, return null
return null;
}
};
return getCurrentScript
}));
/***/ }),
/***/ "c8ba":
@@ -668,49 +753,6 @@ try {
module.exports = g;
/***/ }),
/***/ "f6fd":
/***/ (function(module, exports) {
// document.currentScript polyfill by Adam Miller
// MIT license
(function(document){
var currentScript = "currentScript",
scripts = document.getElementsByTagName('script'); // Live NodeList collection
// If browser needs currentScript polyfill, add get currentScript() to the document object
if (!(currentScript in document)) {
Object.defineProperty(document, currentScript, {
get: function(){
// IE 6-10 supports script readyState
// IE 10+ support stack trace
try { throw new Error(); }
catch (err) {
// Find the second match for the "at" string to get file src url from stack.
// Specifically works with the format of stack traces in IE.
var i, res = ((/.*at [^\(]*\((.*):.+:.+\)$/ig).exec(err.stack) || [false])[1];
// For all scripts on the page, if src matches or if ready state is interactive, return the script tag
for(i in scripts){
if(scripts[i].src == res || scripts[i].readyState == "interactive"){
return scripts[i];
}
}
// If no match, return null
return null;
}
}
});
}
})(document);
/***/ }),
/***/ "fb15":
@@ -723,13 +765,20 @@ __webpack_require__.r(__webpack_exports__);
// This file is imported into lib/wc client bundles.
if (typeof window !== 'undefined') {
var currentScript = window.document.currentScript
if (true) {
__webpack_require__("f6fd")
var getCurrentScript = __webpack_require__("8875")
currentScript = getCurrentScript()
// for backward compatibility, because previously we directly included the polyfill
if (!('currentScript' in document)) {
Object.defineProperty(document, 'currentScript', { get: getCurrentScript })
}
}
var setPublicPath_i
if ((setPublicPath_i = window.document.currentScript) && (setPublicPath_i = setPublicPath_i.src.match(/(.+\/)[^/]+\.js(\?.*)?$/))) {
__webpack_require__.p = setPublicPath_i[1] // eslint-disable-line
var src = currentScript && currentScript.src.match(/(.+\/)[^/]+\.js(\?.*)?$/)
if (src) {
__webpack_require__.p = src[1] // eslint-disable-line
}
}
@@ -1088,20 +1137,29 @@ const validMention = _regexSupplant(
{ validMentionPrecedingChars, atSigns },
'g'
)
const validDotMention = _regexSupplant(
'(#{validMentionPrecedingChars})' + // $1: Preceding character
'(#{atSigns})' + // $2: At mark
'([a-zA-Z0-9_\.]{1,20})', // $3: Screen name
// '(/[a-zA-Z][a-zA-Z0-9_-]{0,24})?', // $4: List (optional)
{ validMentionPrecedingChars, atSigns },
'g'
)
// CONCATENATED MODULE: ./src/utils/extractMentions.js
// Extracts mentions from text.
/* harmony default export */ var extractMentions = (function (text) {
/* harmony default export */ var extractMentions = (function (text, options) {
if (!text || !text.match(atSigns)) {
return []
}
const mentions = []
const mentionRegex = options.mentionsWithDots ? validDotMention : validMention
text.replace(validMention, function (match, before, atSign, mentionText, offset, chunk) {
text.replace(mentionRegex, function (match, before, atSign, mentionText, offset, chunk) {
const after = chunk.slice(offset + match.length)
if (!after.match(endMentionMatch)) {
const startPosition = offset + before.length
@@ -1291,7 +1349,7 @@ const extractUrlsWithIndices = function (text, options = DEFAULT_PROTOCOL_OPTION
/* harmony default export */ var extract = (function (text, options) {
const entities = extractUrls(text, options)
.concat(extractMentions(text))
.concat(extractMentions(text, options))
.concat(extractHashtags(text))
if (entities.length === 0) {
@@ -1356,7 +1414,8 @@ const OPTIONS_NOT_ATTRIBUTES = {
invisibleTagAttrs: true,
linkAttributeBlock: true,
htmlEscapeNonEntities: true,
extractUrlsWithoutProtocol: true
extractUrlsWithoutProtocol: true,
mentionsWithDots: true
}
/* harmony default export */ var extractHtmlAttrs = (function (options) {
@@ -1606,7 +1665,8 @@ function _insertTag (text, classes = '') {
const defaultOptions = {
targetBlank: true,
extractUrlsWithoutProtocol: true
extractUrlsWithoutProtocol: true,
mentionsWithDots: false
}
function utils_link (text, options = defaultOptions) {
@@ -1668,13 +1728,17 @@ function src_autoLink (text, options) {
return utils_link(text, options)
}
/* harmony default export */ var src = ({
/* harmony default export */ var src_0 = ({
name: 'VueHighlights',
props: {
extractUrlsWithoutProtocol: {
type: Boolean,
default: true
},
mentionsWithDots: {
type: Boolean,
default: false
},
caretColor: {
type: String,
default: '#ccc'
@@ -1697,7 +1761,8 @@ function src_autoLink (text, options) {
},
computedBody () {
return highlight(this.body, {
extractUrlsWithoutProtocol: this.extractUrlsWithoutProtocol
extractUrlsWithoutProtocol: this.extractUrlsWithoutProtocol,
mentionsWithDots: this.mentionsWithDots
})
}
},
@@ -1810,7 +1875,7 @@ function src_autoLink (text, options) {
/* concated harmony reexport autoLink */__webpack_require__.d(__webpack_exports__, "autoLink", function() { return src_autoLink; });
/* harmony default export */ var entry_lib = __webpack_exports__["default"] = (src);
/* harmony default export */ var entry_lib = __webpack_exports__["default"] = (src_0);

File diff suppressed because one or more lines are too long

View File

@@ -650,6 +650,91 @@ module.exports = function(module) {
};
/***/ }),
/***/ "8875":
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// addapted from the document.currentScript polyfill by Adam Miller
// MIT license
// source: https://github.com/amiller-gh/currentScript-polyfill
// added support for Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1620505
(function (root, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {}
}(typeof self !== 'undefined' ? self : this, function () {
function getCurrentScript () {
var descriptor = Object.getOwnPropertyDescriptor(document, 'currentScript')
// for chrome
if (!descriptor && 'currentScript' in document && document.currentScript) {
return document.currentScript
}
// for other browsers with native support for currentScript
if (descriptor && descriptor.get !== getCurrentScript && document.currentScript) {
return document.currentScript
}
// IE 8-10 support script readyState
// IE 11+ & Firefox support stack trace
try {
throw new Error();
}
catch (err) {
// Find the second match for the "at" string to get file src url from stack.
var ieStackRegExp = /.*at [^(]*\((.*):(.+):(.+)\)$/ig,
ffStackRegExp = /@([^@]*):(\d+):(\d+)\s*$/ig,
stackDetails = ieStackRegExp.exec(err.stack) || ffStackRegExp.exec(err.stack),
scriptLocation = (stackDetails && stackDetails[1]) || false,
line = (stackDetails && stackDetails[2]) || false,
currentLocation = document.location.href.replace(document.location.hash, ''),
pageSource,
inlineScriptSourceRegExp,
inlineScriptSource,
scripts = document.getElementsByTagName('script'); // Live NodeList collection
if (scriptLocation === currentLocation) {
pageSource = document.documentElement.outerHTML;
inlineScriptSourceRegExp = new RegExp('(?:[^\\n]+?\\n){0,' + (line - 2) + '}[^<]*<script>([\\d\\D]*?)<\\/script>[\\d\\D]*', 'i');
inlineScriptSource = pageSource.replace(inlineScriptSourceRegExp, '$1').trim();
}
for (var i = 0; i < scripts.length; i++) {
// If ready state is interactive, return the script tag
if (scripts[i].readyState === 'interactive') {
return scripts[i];
}
// If src matches, return the script tag
if (scripts[i].src === scriptLocation) {
return scripts[i];
}
// If inline source matches, return the script tag
if (
scriptLocation === currentLocation &&
scripts[i].innerHTML &&
scripts[i].innerHTML.trim() === inlineScriptSource
) {
return scripts[i];
}
}
// If no match, return null
return null;
}
};
return getCurrentScript
}));
/***/ }),
/***/ "c8ba":
@@ -677,49 +762,6 @@ try {
module.exports = g;
/***/ }),
/***/ "f6fd":
/***/ (function(module, exports) {
// document.currentScript polyfill by Adam Miller
// MIT license
(function(document){
var currentScript = "currentScript",
scripts = document.getElementsByTagName('script'); // Live NodeList collection
// If browser needs currentScript polyfill, add get currentScript() to the document object
if (!(currentScript in document)) {
Object.defineProperty(document, currentScript, {
get: function(){
// IE 6-10 supports script readyState
// IE 10+ support stack trace
try { throw new Error(); }
catch (err) {
// Find the second match for the "at" string to get file src url from stack.
// Specifically works with the format of stack traces in IE.
var i, res = ((/.*at [^\(]*\((.*):.+:.+\)$/ig).exec(err.stack) || [false])[1];
// For all scripts on the page, if src matches or if ready state is interactive, return the script tag
for(i in scripts){
if(scripts[i].src == res || scripts[i].readyState == "interactive"){
return scripts[i];
}
}
// If no match, return null
return null;
}
}
});
}
})(document);
/***/ }),
/***/ "fb15":
@@ -732,13 +774,20 @@ __webpack_require__.r(__webpack_exports__);
// This file is imported into lib/wc client bundles.
if (typeof window !== 'undefined') {
var currentScript = window.document.currentScript
if (true) {
__webpack_require__("f6fd")
var getCurrentScript = __webpack_require__("8875")
currentScript = getCurrentScript()
// for backward compatibility, because previously we directly included the polyfill
if (!('currentScript' in document)) {
Object.defineProperty(document, 'currentScript', { get: getCurrentScript })
}
}
var setPublicPath_i
if ((setPublicPath_i = window.document.currentScript) && (setPublicPath_i = setPublicPath_i.src.match(/(.+\/)[^/]+\.js(\?.*)?$/))) {
__webpack_require__.p = setPublicPath_i[1] // eslint-disable-line
var src = currentScript && currentScript.src.match(/(.+\/)[^/]+\.js(\?.*)?$/)
if (src) {
__webpack_require__.p = src[1] // eslint-disable-line
}
}
@@ -1097,20 +1146,29 @@ const validMention = _regexSupplant(
{ validMentionPrecedingChars, atSigns },
'g'
)
const validDotMention = _regexSupplant(
'(#{validMentionPrecedingChars})' + // $1: Preceding character
'(#{atSigns})' + // $2: At mark
'([a-zA-Z0-9_\.]{1,20})', // $3: Screen name
// '(/[a-zA-Z][a-zA-Z0-9_-]{0,24})?', // $4: List (optional)
{ validMentionPrecedingChars, atSigns },
'g'
)
// CONCATENATED MODULE: ./src/utils/extractMentions.js
// Extracts mentions from text.
/* harmony default export */ var extractMentions = (function (text) {
/* harmony default export */ var extractMentions = (function (text, options) {
if (!text || !text.match(atSigns)) {
return []
}
const mentions = []
const mentionRegex = options.mentionsWithDots ? validDotMention : validMention
text.replace(validMention, function (match, before, atSign, mentionText, offset, chunk) {
text.replace(mentionRegex, function (match, before, atSign, mentionText, offset, chunk) {
const after = chunk.slice(offset + match.length)
if (!after.match(endMentionMatch)) {
const startPosition = offset + before.length
@@ -1300,7 +1358,7 @@ const extractUrlsWithIndices = function (text, options = DEFAULT_PROTOCOL_OPTION
/* harmony default export */ var extract = (function (text, options) {
const entities = extractUrls(text, options)
.concat(extractMentions(text))
.concat(extractMentions(text, options))
.concat(extractHashtags(text))
if (entities.length === 0) {
@@ -1365,7 +1423,8 @@ const OPTIONS_NOT_ATTRIBUTES = {
invisibleTagAttrs: true,
linkAttributeBlock: true,
htmlEscapeNonEntities: true,
extractUrlsWithoutProtocol: true
extractUrlsWithoutProtocol: true,
mentionsWithDots: true
}
/* harmony default export */ var extractHtmlAttrs = (function (options) {
@@ -1615,7 +1674,8 @@ function _insertTag (text, classes = '') {
const defaultOptions = {
targetBlank: true,
extractUrlsWithoutProtocol: true
extractUrlsWithoutProtocol: true,
mentionsWithDots: false
}
function utils_link (text, options = defaultOptions) {
@@ -1677,13 +1737,17 @@ function src_autoLink (text, options) {
return utils_link(text, options)
}
/* harmony default export */ var src = ({
/* harmony default export */ var src_0 = ({
name: 'VueHighlights',
props: {
extractUrlsWithoutProtocol: {
type: Boolean,
default: true
},
mentionsWithDots: {
type: Boolean,
default: false
},
caretColor: {
type: String,
default: '#ccc'
@@ -1706,7 +1770,8 @@ function src_autoLink (text, options) {
},
computedBody () {
return highlight(this.body, {
extractUrlsWithoutProtocol: this.extractUrlsWithoutProtocol
extractUrlsWithoutProtocol: this.extractUrlsWithoutProtocol,
mentionsWithDots: this.mentionsWithDots
})
}
},
@@ -1819,7 +1884,7 @@ function src_autoLink (text, options) {
/* concated harmony reexport autoLink */__webpack_require__.d(__webpack_exports__, "autoLink", function() { return src_autoLink; });
/* harmony default export */ var entry_lib = __webpack_exports__["default"] = (src);
/* harmony default export */ var entry_lib = __webpack_exports__["default"] = (src_0);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long