"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.removeTextAlignAndLineSpacing = removeTextAlignAndLineSpacing;
exports.clearCustomStyleAttribute = clearCustomStyleAttribute;

var _prosemirrorModel = require("prosemirror-model");

var _prosemirrorTransform = require("prosemirror-transform");

var _TextAlignCommand = require("./TextAlignCommand");

var _TextLineSpacingCommand = require("./TextLineSpacingCommand");

var _ParagraphSpacingCommand = require("./ParagraphSpacingCommand");

var _ParagraphNodeSpec = require("./ParagraphNodeSpec");

// [FS] IRAD-1053 2020-11-13
// Issue fix: Line spacing and paragraph spacing not removed when select Remove style.
function removeTextAlignAndLineSpacing(tr, schema) {
  tr = (0, _TextAlignCommand.setTextAlign)(tr, schema, null); // to remove the applied line spacing

  tr = (0, _TextLineSpacingCommand.setTextLineSpacing)(tr, schema, null); // to remove the paragraph spacing after format

  tr = (0, _ParagraphSpacingCommand.setParagraphSpacing)(tr, schema, '0', true); // to remove the paragraph spacing before format

  tr = (0, _ParagraphSpacingCommand.setParagraphSpacing)(tr, schema, '0', false);
  return tr;
}

function clearCustomStyleAttribute(node) {
  if (node.attrs) {
    if (node.attrs.styleName) {
      node.attrs.styleName = _ParagraphNodeSpec.RESERVED_STYLE_NONE;
    } //ToDo: Need to handle indent override


    node.attrs.indent = null;
  }
}