@hailin-zheng/editor-core 1.1.27 → 1.1.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -5963,11 +5963,14 @@ class ElementSerialize {
5963
5963
  * @param viewOptions
5964
5964
  */
5965
5965
  static serialize(element, viewOptions) {
5966
+ const result = element.serialize(viewOptions);
5967
+ if (!result) {
5968
+ return null;
5969
+ }
5970
+ if (result.complete) {
5971
+ return result;
5972
+ }
5966
5973
  if (element instanceof BranchElement) {
5967
- const result = element.serialize(viewOptions);
5968
- if (!result || result.complete) {
5969
- return result;
5970
- }
5971
5974
  result.children = [];
5972
5975
  let prevEle = null;
5973
5976
  for (let i = 0; i < element.length; i++) {
@@ -5982,9 +5985,6 @@ class ElementSerialize {
5982
5985
  if (serializeChild) {
5983
5986
  delete serializeChild.complete;
5984
5987
  serializeChild.props = serializeChild.props || {};
5985
- if (child.props && child.props['__attachedProperty']) {
5986
- serializeChild.props['__attachedProperty'] = CommonUtil.cloneValue(child.props['__attachedProperty']);
5987
- }
5988
5988
  if (Object.keys(serializeChild.props).length === 0) {
5989
5989
  delete serializeChild.props;
5990
5990
  }
@@ -5997,9 +5997,10 @@ class ElementSerialize {
5997
5997
  }
5998
5998
  return result;
5999
5999
  }
6000
- else {
6001
- return element.serialize(viewOptions);
6000
+ if (element.props && element.props['__attachedProperty'] && !result.props['__attachedProperty']) {
6001
+ result.props['__attachedProperty'] = CommonUtil.cloneValue(element.props['__attachedProperty']);
6002
6002
  }
6003
+ return result;
6003
6004
  }
6004
6005
  static serializeString(element, options = { all: false }) {
6005
6006
  if (!options.all && element instanceof TrackRunElement && element.type === TrackRunTypeEnum.Deleted) {