Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FontFamily plugin: Font name and alias name swapped when using the ‘fontFamilyDefaultSelection’ option #4867

Open
SKPFCW opened this issue Jan 24, 2025 · 0 comments

Comments

@SKPFCW
Copy link

SKPFCW commented Jan 24, 2025

If the ‘fontFamilyDefaultSelection’ option is set, the content of the editor document is wrapped in a DIV when the html.get() method is executed, which carries the alias name used in the style attribute instead of the font name. Equivalently, the alias name is entered in the default-styles-css if the ‘useClasses’ option is set.

Example:

Froala-Config:

var myInstance = new FroalaEditor("#froala-editor", {
  toolbarButtons: [
    "fontFamily"
  ]
  , plugins: [
    "fontFamily"    
  ]
  , fontFamily: {
    "Segoe UI,sans-serif": "FontAlias1"
    , "Arial Black,sans-serif": "FontAlias2"
    , "Consolas,monospace": "FontAlias3"
  }
  , fontFamilyDefaultSelection: "FontAlias1"
  , fontFamilySelection: true  
});

Content of the editor document

<p>Test Paragraph</p>

myInstance.html.get() returns (alias "FontAlias1" is used insted of fontname):

<div style="font-family: FontAlias1;">
   <p><span style="font-family:Arial Black,sans-serif;">Test Paragraph</span></p>
</div>

The same problem occurs when using the ‘fontSizeDefaultSelection’ option in conjunction with the ‘fontSize’ plugin.
The error occurred for the first time in version 4.2.1.

See fiddle: https://jsfiddle.net/gpdt91a4/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant