Redactor font family
Permalink 1 user found helpful
The goal is to add more fonts to the fontfamily.js.
I added the plugin in a redactor placed on a dashboard single page in a package.
This works as expected.
Now I want to add more fonts to this dropdown. To achieve this I copied the from to and added some fonts to the fonts-variable like so:
But no luck.
Even if I add fonts directly to the core file, just for testing it does nothing. Cache cleared. Cache settings are for development (everything off)
So, what am I missing?
UPDATE:
I register the js file in the package controllers on_start method like so (along with others which are working fine):
and in the single page controllers on_start method:
but it's still the same...
UPDATE II:
It seems that my fontfamily.js is loaded before the core-redactor.js in the DOM. So How to include it afterwoods?
I added the plugin in a redactor placed on a dashboard single page in a package.
$('#textarea').redactor({ ..., plugins: ['fontfamily'] });
This works as expected.
Now I want to add more fonts to this dropdown. To achieve this I copied the
fontfamily.js
/concrete/js/build/vendor/redactor/fontfamily.js
/packages/package_handle/js/build/vendor/redactor/fontfamily.js
... init: function () { var fonts = [ 'Arial', 'Helvetica', 'Georgia', 'Times New Roman', 'Monospace', 'Ubuntu' , 'Other-Fonts']; ...
Even if I add fonts directly to the core file, just for testing
/concrete/js/build/vendor/redactor/fontfamily.js
So, what am I missing?
UPDATE:
I register the js file in the package controllers on_start method like so (along with others which are working fine):
... $al->register( 'javascript', 'fontfamily', 'js/build/vendor/redactor/fontfamily.js', array('position' => \Asset::ASSET_POSITION_FOOTER), $pkg );
$this->requireAsset('javascript', 'fontfamily');
UPDATE II:
It seems that my fontfamily.js is loaded before the core-redactor.js in the DOM. So How to include it afterwoods?
Hi Daenu,
Are you open to creating a How-To based on your solution?
Are you open to creating a How-To based on your solution?
Hi MrKDilkington
(Nice name btw)
Good idea! I will do
(Nice name btw)
Good idea! I will do
@MrKDilkington
Done! It just needs to be approved
Done! It just needs to be approved
@Daenu
That is excellent.
Hopefully you've been bitten with the How-To/tutorial bug and want to write more.
That is excellent.
Hopefully you've been bitten with the How-To/tutorial bug and want to write more.
1. Rename the js file to something unique, like myfonts.js
2. Register it in the package controllers on_start method:
3. In the single page controllers on_start method, require the asset like any other:
4. On the desired single page, call the plugin like so:
That's it! Don't forget to empty cache and reinstall the package.