Skip to content

Instantly share code, notes, and snippets.

@gheydon
Last active December 14, 2023 05:32
Show Gist options
  • Save gheydon/4520868b4a4165b1701f00d4aefab496 to your computer and use it in GitHub Desktop.
Save gheydon/4520868b4a4165b1701f00d4aefab496 to your computer and use it in GitHub Desktop.
How to load remote google fonts into CKeditor 5
name: Example
description: 'Example theme'
base theme: false
type: theme
package: example
core_version_requirement: ^10
ckeditor_stylesheets:
- //fonts.googleapis.com/css2?family=Public+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap
- //fonts.googleapis.com/icon?family=Material+Icons
#
# In CKEditor 4 you were able to load remote style sheets as above. You are unable to do this in CKEditor 5 and
# causes a crash. To get around this create a library to load the fonts when ckeditor 5 is loaded.
#
libraries-extend:
ckeditor5/internal.drupal.ckeditor5.htmlEngine:
- example_theme/ckeditor5_google_fonts
ckeditor5_google_fonts:
css:
component:
//fonts.googleapis.com/css2?family=Public+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap: {}
//fonts.googleapis.com/icon?family=Material+Icons: {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment