king
2021-03-31 4f5f8002496e8b32c1ba83e9d3a0674e61c41c03
src/tabviews/zshare/mutilform/customTextArea/index.jsx
@@ -14,19 +14,19 @@
  state = {
    value: '',
    encryption: 'false'
    encryption: false
  }
  UNSAFE_componentWillMount () {
    let value = ''
    let encryption = 'false'
    let encryption = false
    if (this.props['data-__meta']) {
      value = this.props['data-__meta'].initialValue || ''
    }
    if (this.props.Item && this.props.Item.encryption === 'true') {
      encryption = 'true'
      encryption = true
      if (value) {
        try {
          value = window.decodeURIComponent(window.atob(value))
@@ -42,6 +42,22 @@
    })
  }
  UNSAFE_componentWillReceiveProps(nextProps) {
    const { value, encryption } = this.state
    if (!encryption && value !== nextProps.value) {
      this.setState({ value: nextProps.value || '' })
    } else if (encryption && window.btoa(window.encodeURIComponent(value)) !== nextProps.value) {
      let _value = nextProps.value || ''
      try {
        _value = window.decodeURIComponent(window.atob(_value))
      } catch {
        _value = nextProps.value || ''
      }
      this.setState({ value: _value })
    }
  }
  onChange = (e) => {
    const { encryption } = this.state
    let val = e.target.value
@@ -49,7 +65,7 @@
    this.setState({ value: val })
    let _val = val
    if (encryption === 'true') {
    if (encryption) {
      try {
        _val = window.btoa(window.encodeURIComponent(_val))
      } catch {