Open wolfomat opened 9 months ago
@wolfomat Did you get this to work? I am having the same problem
@wolfomat Did you get this to work? I am having the same problem
Hi @pennan88 ; in fact i did not get this to work and it seems to be still persitent in 7.0.0
@wolfomat Yes. i noticed that as well. Hopefully it gets fixed someday
I think I found a workaround on this issue (in my case this worked. I'm using react):
// Editor.tsx
import { Editor as EditorType } from 'tinymce'
export type TextEditorType = {
onInit: (editor: EditorType) => void
}
function Editor( {
onInit
}: TextEditorType ): JSX.Element {
.....
return (
<Editor
onInit={ ( _, editor ) => onInit( editor as unknown as EditorType ) }
..... other props
/>
)
}
// MyComponent.tsx
function MyComponent() {
....
function onEditorInit(editor: EditorType) {
// this do the trick
editor.execCommand( "fontSize", false, "10pt" )
}
return <Editor
onInit={onEditorInit}
/>
}
This forces editor to update it's font size and this also updates fontsizeinput
to update it's value.
@nonam4 Hello! This did work in react just like you said but sadly i am using Blazor WASM so the same solution did not work, but i think its still on the right path so I'll keep trying different approaches.
Hi, did anyone got any solution for this? Thanks
Just hit this one myself..
📝 Provide detailed reproduction steps (if any)
Look at: https://codepen.io/wolfomat/pen/NWoedGa
✔️ Expected result
I'd expect that in the input-box the unit would be for example Npt, where N is any number
❌ Actual result
The shown and used Unit in the font-size-input is PX.
❓ Possible solution
I'd guess that when the editor is initialized, the setting is not evaluated correctly. when changing the pt unit in the font-input-field, the editor will still work.
📃 Other details
If you'd like to see this fixed sooner, add a 👍 reaction to this post.