Skip to content

Commit

Permalink
fix: Modifying MENTION_START regex to work on older MobileSafari vers…
Browse files Browse the repository at this point in the history
…ions

Fixes RichText causes errors on WebKit | Invalid regex nextcloud-libraries#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.

Co-authored-by: Maksim Sukharev <[email protected]>
Signed-off-by: Arthur Rosa <[email protected]>
  • Loading branch information
2 people authored and susnux committed Aug 20, 2024
1 parent 756d004 commit 38d3afe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/mixins/richEditor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ 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
// Beginning or whitespace. Uses positive lookahead (to work on MobileSafari <16.4)
const MENTION_START = /(?=[a-z0-9_\-@.'])\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 38d3afe

Please sign in to comment.