|
@@ -139,6 +139,10 @@ export default class DocumentSelection {
|
|
|
return this._selection.isBackward;
|
|
return this._selection.isBackward;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ get isGravityOverridden() {
|
|
|
|
|
+ return this._selection._isGravityOverriden;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Used for the compatibility with the {@link module:engine/model/selection~Selection#isEqual} method.
|
|
* Used for the compatibility with the {@link module:engine/model/selection~Selection#isEqual} method.
|
|
|
*
|
|
*
|
|
@@ -391,12 +395,23 @@ export default class DocumentSelection {
|
|
|
/**
|
|
/**
|
|
|
* Temporarily and partially disables default gravity behaviour that tries to get attributes from nodes surrounding the caret.
|
|
* Temporarily and partially disables default gravity behaviour that tries to get attributes from nodes surrounding the caret.
|
|
|
* @see module:engine/model/writer~Writer#overrideGravity
|
|
* @see module:engine/model/writer~Writer#overrideGravity
|
|
|
|
|
+ *
|
|
|
|
|
+ * @protected
|
|
|
*/
|
|
*/
|
|
|
_overrideGravity() {
|
|
_overrideGravity() {
|
|
|
this._selection.overrideGravity();
|
|
this._selection.overrideGravity();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * Restore overridden gravity.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @protected
|
|
|
|
|
+ */
|
|
|
|
|
+ _restoreGravity() {
|
|
|
|
|
+ this._selection.restoreGravity();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
* Generates and returns an attribute key for selection attributes store, basing on original attribute key.
|
|
* Generates and returns an attribute key for selection attributes store, basing on original attribute key.
|
|
|
*
|
|
*
|
|
|
* @protected
|
|
* @protected
|
|
@@ -476,7 +491,7 @@ class LiveSelection extends Selection {
|
|
|
// When is set as `true` then selection attributes on node before the caret won't be taken
|
|
// When is set as `true` then selection attributes on node before the caret won't be taken
|
|
|
// into consideration while updating selection attributes.
|
|
// into consideration while updating selection attributes.
|
|
|
//
|
|
//
|
|
|
- // @private
|
|
|
|
|
|
|
+ // @protected
|
|
|
// @type {Boolean}
|
|
// @type {Boolean}
|
|
|
this._isGravityOverriden = false;
|
|
this._isGravityOverriden = false;
|
|
|
|
|
|
|
@@ -629,6 +644,11 @@ class LiveSelection extends Selection {
|
|
|
this._updateAttributes();
|
|
this._updateAttributes();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ restoreGravity() {
|
|
|
|
|
+ this._isGravityOverriden = false;
|
|
|
|
|
+ this._updateAttributes();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// Removes all attributes from the selection and sets attributes according to the surrounding nodes.
|
|
// Removes all attributes from the selection and sets attributes according to the surrounding nodes.
|
|
|
_refreshAttributes() {
|
|
_refreshAttributes() {
|
|
|
this._updateAttributes( true );
|
|
this._updateAttributes( true );
|