File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
client/modules/IDE/components/Editor Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -258,8 +258,23 @@ function getFileEmmetConfig(fileName) {
258258 }
259259}
260260
261+ function getColorPickerAtSelection ( view ) {
262+ const { head } = view . state . selection . main ;
263+ const { node } = view . domAtPos ( head ) ;
264+
265+ const startEl =
266+ node . nodeType === Node . ELEMENT_NODE ? node : node . parentElement ;
267+
268+ const lineEl = startEl ?. closest ( '.cm-line' ) ;
269+
270+ return (
271+ lineEl ?. querySelector ( 'input[type="color"]:not(:disabled)' ) ||
272+ view . contentDOM . querySelector ( 'input[type="color"]:not(:disabled)' )
273+ ) ;
274+ }
275+
261276function openColorPickerWithKeyboard ( view ) {
262- const picker = view . contentDOM . querySelector ( 'input[type="color"]' ) ;
277+ const picker = getColorPickerAtSelection ( view ) ;
263278
264279 if ( ! picker || picker . disabled ) {
265280 return false ;
You can’t perform that action at this time.
0 commit comments