Closed vpn-dev closed 3 months ago
@hand-dot can you have a look at this? we can discuss this issue..
Hey @vpn-dev,
Could you show me the code?
Absolutely, here is screenshot of code of my extended property on schema in propPanel for textPlugin
@hand-dot as you can see in the above code snippet i have extended text schema with fontColorFromTheme property, on which I have added onChange to change actual fontColor property of text schema but this is causing all active changes to schema go away. if none is selected from fontColorFromTheme property I am just resetting the fontColor Value otherwise I am extracting the value from my theme object which is a material ui theme object , I am doing this to use same template for multiple themes.
I tried other way as well by assigning value to schema.fontColor in uiRender function but this change is not immediate there.
Ideally it should work, as in UseDynamicSizeWidget you have done the same thing by calling changeSchemas on onChange of checkbox.
Can you suggest better way
@vpn-dev
The code looks good, and I understand what you are trying to achieve.
Please share a screenshot or the executable code to show exactly what behavior you are experiencing. It would be helpful if you could share it using a service like the one below, as it makes it easier to test.
Could you fork the following code, install the latest pdfme 3.2.2, incorporate your plugin, and then share it with me? https://stackblitz.com/~/github.com/pdfme/pdfme-playground
@hand-dot I have made fork of this repo with my changes in it https://stackblitz.com/~/github.com/vpn-dev/pdfme-playground
Kazam_screencast_00004.webm @hand-dot you can see the issue in above video as I said when I am changing newly added select widgets i/e backgroundFromTheme and fontColorFromTheme other active changes on text but which are not committed yet are lost
@vpn-dev Thank you. I was able to observe the same behavior on my computer as well. This is a bug. I will investigate the cause and aim to fix it.
@vpn-dev Can you check bellow?
It seems that overriding onChange
and calling changeSchemas
disrupts the existing change processes. The UseDynamicSizeWidget
is operating as intended by skipping the existing change processes entirely due to bind: false
.
In this fix, rather than overriding onChange
, I have set it up to reflect the theme color during the initialization of propPanel.schema
.
Hey @hand-dot thanks a lot, this solution completely works.. :100:
Describe the bug
I extended text plugin with some extra properties like backgroundColorFromTheme in which colors are shown in select menu, i added onChange handle for this select in propPanel which uses changeSchemas function to update value of original background color property but it also changes other properties of text which are not commited to earlier version.
To Reproduce
Expected behavior
It should only change shemas that are provided in function params not all ...
Your Environment
Your Error Log
Additional context
No response