Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

focus状态怎么取消 #200

Open
weige0088 opened this issue Apr 20, 2018 · 14 comments
Open

focus状态怎么取消 #200

weige0088 opened this issue Apr 20, 2018 · 14 comments

Comments

@weige0088
Copy link

weige0088 commented Apr 20, 2018

页面一打开就会自动定位并且 focus 到 文本编辑器的位置;
如何取消这种 focus,呢
image

@llyer
Copy link

llyer commented Apr 27, 2018

同样遇到了这个问题。。。还不知道怎么解决

@xiaojiangjiang
Copy link

same question +1

@zuilafeng
Copy link

same question + 1

4 similar comments
@houcz9
Copy link

houcz9 commented Jun 27, 2018

same question + 1

@zhangwei900808
Copy link

same question + 1

@wakame-isono
Copy link

same question + 1

@Coande
Copy link

Coande commented Aug 29, 2018

same question + 1

@Coande
Copy link

Coande commented Aug 29, 2018

按照这个来写:#197 (comment)

  watch: {
    // Watch content change
    value(newVal) {
      if (this.$refs.quillEditor.quill) {
        if (newVal && newVal !== this._content) {
          this._content = newVal;
          this.$refs.quillEditor.quill
            .setContents(this.$refs.quillEditor.quill.clipboard.convert(newVal));
        } else if (!newVal) {
          this.$refs.quillEditor.quill.setText('');
        }
      }
    }
  }

焦点是取消了,但是,每次输入的时候光标自动跳到开始位置了。

没人解决吗?

@sogoquick
Copy link

按照这个来写:#197 (comment)

  watch: {
    // Watch content change
    value(newVal) {
      if (this.$refs.quillEditor.quill) {
        if (newVal && newVal !== this._content) {
          this._content = newVal;
          this.$refs.quillEditor.quill
            .setContents(this.$refs.quillEditor.quill.clipboard.convert(newVal));
        } else if (!newVal) {
          this.$refs.quillEditor.quill.setText('');
        }
      }
    }
  }

焦点是取消了,但是,每次输入的时候光标自动跳到开始位置了。

没人解决吗?

you can add one params to control just do one time when you load it , like that
if (this.$refs.quillEditor.quill && this.firstPaint) {
....
this.firstPaint = false;
}
firstPaint Init Data ,the default value is True

BTW:
If you use ember your code ,it not component , direct use quill.blur() when finish init the data

@ghost
Copy link

ghost commented Dec 1, 2018

这个方法实测有效
https://blog.csdn.net/nickroprak/article/details/80887808

@weirdo-o
Copy link

问题解决了吗...

@zhidanwang19910111
Copy link

在此issue 基础上还有一个功能问题是:当输入内容后,点击外部的一个button ,不失去焦点

@wangjiang6541
Copy link

在此发行基础上还有一个功能问题是:当输入内容后,点击外部的一个按钮,不失去焦点

我和你遇到了一样的问题,点击外部按钮,富文本不会触发blur事件,除非点在其他的空白处

@shaunhurryup
Copy link

First, bind an attribute to the <quill-editor ref="myQuillEditor">
Then, cancel auto-focus in lifecycle hooks mounted()

mounted() {
    this.$refs.myQuillEditor.quill.enable(false)
  },

REMEMBER, cancel operation should add in .vue that import import { quillEditor } from 'vue-quill-editor'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests