File tree 1 file changed +9
-3
lines changed
1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -559,6 +559,7 @@ export const toggleDecorations = (flag: boolean) => {
559
559
newInput . onchange = async ( e ) => {
560
560
const target = e . target as HTMLInputElement ;
561
561
const newColor = target . value ;
562
+ const colorString = newColor . replace ( "#" , "" ) ;
562
563
const uid = getBlockUidFromTarget ( target ) ;
563
564
const blockText = getTextByBlockUid ( uid ) ;
564
565
const newText = blockText . replace (
@@ -568,10 +569,15 @@ export const toggleDecorations = (flag: boolean) => {
568
569
await window . roamAlphaAPI . updateBlock ( {
569
570
block : { uid, string : newText } ,
570
571
} ) ;
571
- target . value = newColor ;
572
- toggleDecorations ( false ) ;
572
+ const parent = renderedRef . closest ( `.roam-block` ) ;
573
573
setTimeout ( ( ) => {
574
- toggleDecorations ( true ) ;
574
+ const afterChangeInput = parent ?. querySelector (
575
+ `[data-tag="${ colorString } "]`
576
+ ) ;
577
+ afterChangeInput ?. appendChild ( newInput ) ;
578
+ if ( colorString === "ffffff" )
579
+ newInput . style . boxShadow =
580
+ "inset 0 0 0 1px hsla(0,0%,0%,.2)" ;
575
581
} , 100 ) ;
576
582
} ;
577
583
} ) ;
You can’t perform that action at this time.
0 commit comments