Skip to content

Commit 186365e

Browse files
authored
Merge pull request #6779 from nextcloud-libraries/refactor/drop-dependency
2 parents 2e6e51c + d8ac8ed commit 186365e

File tree

3 files changed

+6
-43
lines changed

3 files changed

+6
-43
lines changed

package-lock.json

-40
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@
104104
"remark-parse": "^11.0.0",
105105
"remark-rehype": "^11.1.1",
106106
"splitpanes": "^4.0.3",
107-
"string-length": "^6.0.0",
108107
"striptags": "^3.2.0",
109108
"tabbable": "^6.2.0",
110109
"tributejs": "^5.1.3",

src/components/NcRichContenteditable/NcRichContenteditable.vue

+6-2
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,6 @@ import { createElementId } from '../../utils/createElementId.ts'
293293

294294
import Tribute from 'tributejs/dist/tribute.esm.js'
295295
import debounce from 'debounce'
296-
import stringLength from 'string-length'
297296

298297
/**
299298
* Populate the list of text smiles we want to offer via Tribute.
@@ -420,11 +419,15 @@ export default {
420419
],
421420

422421
setup() {
422+
const segmenter = new Intl.Segmenter()
423+
423424
return {
424425
// Constants
425426
labelId: createElementId(),
426427
tributeId: createElementId(),
427428

429+
segmenter,
430+
428431
/**
429432
* Non-reactive property to store Tribute instance
430433
*
@@ -471,7 +474,8 @@ export default {
471474
if (this.isEmptyValue || !this.maxlength) {
472475
return false
473476
}
474-
return stringLength(this.localValue) > this.maxlength
477+
const length = [...this.segmenter.segment(this.localValue)].length
478+
return length > this.maxlength
475479
},
476480

477481
/**

0 commit comments

Comments
 (0)