Skip to content

Commit

Permalink
Modifying MENTION_START regex to work on older MobileSafari versions
Browse files Browse the repository at this point in the history
Fixes RichText causes errors on WebKit | Invalid regex #5589

This regex performs the same function as the one used before, but does not make use of negative lookbehinds and therefore should work on older MobileSafari versions.

Signed-off-by: Arthur Rosa <arthur@rosafamily.net>
  • Loading branch information
arthurlockman committed Aug 19, 2024
1 parent cdda305 commit f7ea735
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/mixins/richEditor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ import stripTags from 'striptags'
import Vue from 'vue'

// Referenced from public function getMentions(): https://github.com/nextcloud/server/blob/master/lib/private/Comments/Comment.php
// Beginning or whitespace. Non-capturing group within word boundary
const MENTION_START = /\B(?<![^a-z0-9_\-@.'\s])/.source
// Modified to work on MobileSafari <16.4 (see issue #5589: https://github.com/nextcloud-libraries/nextcloud-vue/issues/5589)
// Beginning or whitespace.
const MENTION_START = /[a-z0-9_\-@.'\s]\B/.source
// Capturing groups like: @user-id, @"guest/abc16def", @"federated_user/user-id", @"user-id with space"
const MENTION_SIMPLE = /(@[a-z0-9_\-@.']+)/.source
const MENTION_GUEST = /@&quot;guest\/[a-f0-9]+&quot;/.source
Expand Down

0 comments on commit f7ea735

Please sign in to comment.