@tiptap/suggestion
Advanced tools
Comparing version 2.0.0-beta.63 to 2.0.0-beta.64
@@ -6,2 +6,13 @@ # Change Log | ||
# [2.0.0-beta.64](https://github.com/ueberdosis/tiptap/compare/@tiptap/suggestion@2.0.0-beta.63...@tiptap/suggestion@2.0.0-beta.64) (2021-08-13) | ||
### Bug Fixes | ||
* improve suggestion handling for chinese input, fix [#1449](https://github.com/ueberdosis/tiptap/issues/1449) ([9789372](https://github.com/ueberdosis/tiptap/commit/9789372cea901b21059d53c30ff301efb35fb720)) | ||
# [2.0.0-beta.63](https://github.com/ueberdosis/tiptap/compare/@tiptap/suggestion@2.0.0-beta.62...@tiptap/suggestion@2.0.0-beta.63) (2021-08-13) | ||
@@ -8,0 +19,0 @@ |
@@ -128,2 +128,3 @@ 'use strict'; | ||
text: null, | ||
composing: false, | ||
}; | ||
@@ -133,8 +134,14 @@ }, | ||
apply(transaction, prev) { | ||
const { composing } = editor.view; | ||
const { selection } = transaction; | ||
const { empty, from } = selection; | ||
const next = { ...prev }; | ||
next.composing = composing; | ||
// We can only be suggesting if there is no selection | ||
if (selection.from === selection.to) { | ||
// or a composition is active (see: https://github.com/ueberdosis/tiptap/issues/1449) | ||
if (empty || editor.view.composing) { | ||
// Reset active state if we just left the previous suggestion range | ||
if (selection.from < prev.range.from || selection.from > prev.range.to) { | ||
if ((from < prev.range.from || from > prev.range.to) | ||
&& !composing | ||
&& !prev.composing) { | ||
next.active = false; | ||
@@ -141,0 +148,0 @@ } |
@@ -124,2 +124,3 @@ import { PluginKey, Plugin } from 'prosemirror-state'; | ||
text: null, | ||
composing: false, | ||
}; | ||
@@ -129,8 +130,14 @@ }, | ||
apply(transaction, prev) { | ||
const { composing } = editor.view; | ||
const { selection } = transaction; | ||
const { empty, from } = selection; | ||
const next = { ...prev }; | ||
next.composing = composing; | ||
// We can only be suggesting if there is no selection | ||
if (selection.from === selection.to) { | ||
// or a composition is active (see: https://github.com/ueberdosis/tiptap/issues/1449) | ||
if (empty || editor.view.composing) { | ||
// Reset active state if we just left the previous suggestion range | ||
if (selection.from < prev.range.from || selection.from > prev.range.to) { | ||
if ((from < prev.range.from || from > prev.range.to) | ||
&& !composing | ||
&& !prev.composing) { | ||
next.active = false; | ||
@@ -137,0 +144,0 @@ } |
@@ -127,2 +127,3 @@ (function (global, factory) { | ||
text: null, | ||
composing: false, | ||
}; | ||
@@ -132,8 +133,14 @@ }, | ||
apply(transaction, prev) { | ||
const { composing } = editor.view; | ||
const { selection } = transaction; | ||
const { empty, from } = selection; | ||
const next = { ...prev }; | ||
next.composing = composing; | ||
// We can only be suggesting if there is no selection | ||
if (selection.from === selection.to) { | ||
// or a composition is active (see: https://github.com/ueberdosis/tiptap/issues/1449) | ||
if (empty || editor.view.composing) { | ||
// Reset active state if we just left the previous suggestion range | ||
if (selection.from < prev.range.from || selection.from > prev.range.to) { | ||
if ((from < prev.range.from || from > prev.range.to) | ||
&& !composing | ||
&& !prev.composing) { | ||
next.active = false; | ||
@@ -140,0 +147,0 @@ } |
{ | ||
"name": "@tiptap/suggestion", | ||
"description": "suggestion plugin for tiptap", | ||
"version": "2.0.0-beta.63", | ||
"version": "2.0.0-beta.64", | ||
"homepage": "https://tiptap.dev", | ||
@@ -36,3 +36,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "d9abb0c736eb53aac8326f67de2e42c4830ca67b" | ||
"gitHead": "731c1640d725b55bee6d654b952fb6fe99ac37bf" | ||
} |
@@ -140,2 +140,3 @@ import { Editor, Range } from '@tiptap/core' | ||
text: null, | ||
composing: false, | ||
} | ||
@@ -146,9 +147,18 @@ }, | ||
apply(transaction, prev) { | ||
const { composing } = editor.view | ||
const { selection } = transaction | ||
const { empty, from } = selection | ||
const next = { ...prev } | ||
next.composing = composing | ||
// We can only be suggesting if there is no selection | ||
if (selection.from === selection.to) { | ||
// or a composition is active (see: https://github.com/ueberdosis/tiptap/issues/1449) | ||
if (empty || editor.view.composing) { | ||
// Reset active state if we just left the previous suggestion range | ||
if (selection.from < prev.range.from || selection.from > prev.range.to) { | ||
if ( | ||
(from < prev.range.from || from > prev.range.to) | ||
&& !composing | ||
&& !prev.composing | ||
) { | ||
next.active = false | ||
@@ -155,0 +165,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
106795
956