-
Notifications
You must be signed in to change notification settings - Fork 800
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Contact Form: Allow users to add multiple options to a dropdown field (…
…#37739) * Contact Form: Allow users to add multiple options to a dropdown field * Bump Forms package version --------- Co-authored-by: Karen Attfield <[email protected]>
- Loading branch information
1 parent
30a8df6
commit 91b2516
Showing
8 changed files
with
54 additions
and
11 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
projects/packages/forms/changelog/fix-dropddown-field-options
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: minor | ||
Type: fixed | ||
|
||
Allow users to add multiple options to a dropdown field |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
projects/packages/forms/src/blocks/contact-form/util/caret.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* Get the caret position in an active contenteditable element | ||
* From https://gist.github.com/loilo/f873a88631e660c59a1d5ab757ca9b1e | ||
* | ||
* @param {HTMLElement} target - Contenteditable element of which to get the caret position | ||
* @returns {number} The caret position | ||
*/ | ||
export const getCaretPosition = target => { | ||
const sel = target.ownerDocument.defaultView.getSelection(); | ||
|
||
if ( sel.rangeCount === 0 ) { | ||
return 0; | ||
} | ||
|
||
const range = sel.getRangeAt( 0 ); | ||
|
||
const preCaretRange = range.cloneRange(); | ||
preCaretRange.selectNodeContents( target ); | ||
preCaretRange.setEnd( range.endContainer, range.endOffset ); | ||
|
||
return preCaretRange.toString().length; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
projects/plugins/jetpack/changelog/fix-dropddown-field-options
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Significance: patch | ||
Type: other | ||
Comment: Updated composer.lock. | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.