1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-07-24 19:48:30 +00:00
* Fixed: Words being highlighted as mentions incorrectly when they start with the user's name.
* API Changed: New `<react-link>` and `<aspect>` global Vue components.
This commit is contained in:
SirStendec 2019-06-05 20:29:33 -04:00
parent 8582626269
commit 4e0539103a
5 changed files with 38 additions and 3 deletions

View file

@ -151,7 +151,7 @@ ${typeof x[1] === 'string' ? x[1] : JSON.stringify(x[1], null, 4)}`
FrankerFaceZ.Logger = Logger; FrankerFaceZ.Logger = Logger;
const VER = FrankerFaceZ.version_info = { const VER = FrankerFaceZ.version_info = {
major: 4, minor: 2, revision: 4, major: 4, minor: 2, revision: 5,
commit: __git_commit__, commit: __git_commit__,
build: __webpack_hash__, build: __webpack_hash__,
toString: () => toString: () =>

View file

@ -13,7 +13,7 @@ import {TWITCH_EMOTE_BASE, REPLACEMENT_BASE, REPLACEMENTS} from 'utilities/const
const EMOTE_CLASS = 'chat-image chat-line__message--emote', const EMOTE_CLASS = 'chat-image chat-line__message--emote',
LINK_REGEX = /([^\w@#%\-+=:~])?((?:(https?:\/\/)?(?:[\w@#%\-+=:~]+\.)+[a-z]{2,6}(?:\/[\w./@#%&()\-+=:?~]*)?))([^\w./@#%&()\-+=:?~]|\s|$)/g, LINK_REGEX = /([^\w@#%\-+=:~])?((?:(https?:\/\/)?(?:[\w@#%\-+=:~]+\.)+[a-z]{2,6}(?:\/[\w./@#%&()\-+=:?~]*)?))([^\w./@#%&()\-+=:?~]|\s|$)/g,
//MENTION_REGEX = /([^\w@#%\-+=:~])?(@([^\u0000-\u007F]+|\w+)+)([^\w./@#%&()\-+=:?~]|\s|$)/g; // eslint-disable-line no-control-regex //MENTION_REGEX = /([^\w@#%\-+=:~])?(@([^\u0000-\u007F]+|\w+)+)([^\w./@#%&()\-+=:?~]|\s|$)/g; // eslint-disable-line no-control-regex
MENTION_REGEX = /^(['"*([{<\\/]*)(@)((?:[^\u0000-\u007F]|[\w-])+)/; // eslint-disable-line no-control-regex MENTION_REGEX = /^(['"*([{<\\/]*)(@)((?:[^\u0000-\u007F]|[\w-])+)(?:\b|$)/; // eslint-disable-line no-control-regex
// ============================================================================ // ============================================================================
@ -232,7 +232,7 @@ export const Mentions = {
display = null; display = null;
mentionable = true; mentionable = true;
regex = new RegExp(`^(['"*([{<\\/]*)(?:(@?)(${user.login.toLowerCase()}${display ? `|${display}` : ''})|@((?:[^\u0000-\u007F]|[\\w-])+))`, 'i'); regex = new RegExp(`^(['"*([{<\\/]*)(?:(@?)(${user.login.toLowerCase()}${display ? `|${display}` : ''})|@((?:[^\u0000-\u007F]|[\\w-])+))(?:\\b|$)`, 'i');
} else } else
regex = MENTION_REGEX; regex = MENTION_REGEX;

View file

@ -0,0 +1,12 @@
<template functional>
<div
:class="`tw-aspect--align-${props.align||'top'}`"
class="tw-aspect"
>
<div
:style="{paddingBottom: (100 * (1 / (props.ratio || 1))) + '%'}"
class="tw-aspect__spacer"
/>
<slot />
</div>
</template>

View file

@ -0,0 +1,13 @@
<template>
<a :href="href" @click="reactNavigate(href, $event)">
<slot />
</a>
</template>
<script>
export default {
props: ['href']
}
</script>

View file

@ -99,6 +99,16 @@ export class Vue extends Module {
vue.mixin({ vue.mixin({
methods: { methods: {
reactNavigate(url, event) {
const router = t.resolve('site.router');
if ( router && router.history ) {
if ( event ) {
event.preventDefault();
event.stopPropagation();
}
router.history.push(url);
}
},
t(key, phrase, options) { t(key, phrase, options) {
return this.$i18n.t_(key, phrase, options); return this.$i18n.t_(key, phrase, options);
}, },