Skip to content

Commit 5ead2d6

Browse files
ShaMan123asturur
andauthored
chore(TS): extract const reNonWord from HEADER (#8197)
Co-authored-by: Andrea Bogazzi <[email protected]>
1 parent cd69a80 commit 5ead2d6

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

HEADER.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,6 @@ fabric.SHARED_ATTRIBUTES = [
7878
/* _FROM_SVG_END_ */
7979

8080

81-
fabric.reNonWord = /[ \n\.,;!\?\-]/;
82-
83-
84-
8581
/**
8682
* @todo move to config when window is exported
8783
*/

src/mixins/itext_behavior.mixin.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
import { Point } from '../point.class';
33
import { removeFromArray } from '../util/internals';
44

5+
// extend this regex to support non english languages
6+
const reNonWord = /[ \n\.,;!\?\-]/;
7+
58
(function(global) {
69
var fabric = global.fabric;
710
fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.prototype */ {
@@ -288,9 +291,7 @@ import { removeFromArray } from '../util/internals';
288291
searchWordBoundary: function(selectionStart, direction) {
289292
var text = this._text,
290293
index = this._reSpace.test(text[selectionStart]) ? selectionStart - 1 : selectionStart,
291-
_char = text[index],
292-
// wrong
293-
reNonWord = fabric.reNonWord;
294+
_char = text[index];
294295

295296
while (!reNonWord.test(_char) && index > 0 && index < text.length) {
296297
index += direction;

0 commit comments

Comments
 (0)