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

[stable7] Input Fields and RichContenteditable: add focus and select methods #4278

Merged
merged 2 commits into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/components/NcInputField/NcInputField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,24 @@ export default {
},

methods: {
/**
* Focus the input element
*
* @public
*/
focus() {
this.$refs.input.focus()
},

/**
* Select all the text in the input
*
* @public
*/
select() {
this.$refs.input.select()
},

handleInput(event) {
this.$emit('update:value', event.target.value)
},
Expand Down
18 changes: 18 additions & 0 deletions src/components/NcPasswordField/NcPasswordField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,24 @@ export default {
},

methods: {
/**
* Focus the input element
*
* @public
*/
focus() {
this.$refs.inputField.focus()
},

/**
* Select all the text in the input
*
* @public
*/
select() {
this.$refs.inputField.select()
},

handleInput(event) {
/**
* Triggers when the value inside the password field is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,15 @@ export default {
},

methods: {
/**
* Focus the richContenteditable
*
* @public
*/
focus() {
this.$refs.contenteditable.focus()
},

getLink(item) {
// there is no way to get a tribute result asynchronously
// so we immediately insert a node and replace it when the result comes
Expand Down
18 changes: 18 additions & 0 deletions src/components/NcTextField/NcTextField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,24 @@ export default {
},

methods: {
/**
* Focus the input element
*
* @public
*/
focus() {
this.$refs.inputField.focus()
},

/**
* Select all the text in the input
*
* @public
*/
select() {
this.$refs.inputField.select()
},

handleInput(event) {
this.$emit('update:value', event.target.value)
},
Expand Down