public componentWillReceiveProps()

in packages/roosterjs-react-editor/lib/components/LeanRooster.tsx [246:274]


    public componentWillReceiveProps(nextProps: LeanRoosterProps, nextState: {}) {
        const div = this._contentDiv;
        if (!div) {
            return;
        }

        const { className, readonly, isRtl, placeholder } = nextProps;

        if (className !== this.props.className) {
            div.setAttribute("class", this._getClassName(nextProps));
        }

        if (readonly !== this.props.readonly) {
            if (readonly) {
                div.classList.add(ReadOnlyClassName);
            } else {
                div.classList.remove(ReadOnlyClassName);
            }
            div.setAttribute("contentEditable", (!readonly).toString());
        }

        if (isRtl !== this.props.isRtl) {
            div.setAttribute("dir", this._getDirValue(isRtl));
        }

        if (placeholder !== this.props.placeholder) {
            div.setAttribute("data-placeholder", placeholder == null ? "" : placeholder);
        }
    }