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

Font plugin: support of point to set font-size #1389

Closed
TatianaAU opened this issue Nov 30, 2018 · 1 comment
Closed

Font plugin: support of point to set font-size #1389

TatianaAU opened this issue Nov 30, 2018 · 1 comment
Assignees
Labels
type:question This issue asks a question (how to...).

Comments

@TatianaAU
Copy link

🆕 Feature request
Font plugin: support for points to set the font-size

💻 Version of CKEditor

inline build v11.1.1, font-plugin v10.0.3

📋 Steps to reproduce

  1. call setData() with html text:
    <p><span style=\"font-size:10pt;\">some text </span></p>

✅ Expected result
Font size applied.

❎ Actual result
Font size remains unchanged for this element.

@jodator jodator self-assigned this Nov 30, 2018
@jodator jodator added type:question This issue asks a question (how to...). resolution:fixed labels Nov 30, 2018
@jodator
Copy link
Contributor

jodator commented Nov 30, 2018

You can achieve this using configuration:

ClassicEditor
	.create( document.querySelector( '#editor' ), {
		plugins: [ ArticlePluginSet, FontSize ],
		toolbar: [
			'heading', '|', 'fontSize' //..., 
		],
		fontSize: {
			options: [
				generatePtSetting( '10' ),
				generatePtSetting( '12' ),
				generatePtSetting( '14' ),
				'default',
				generatePtSetting( '18' ),
				generatePtSetting( '20' ),
				generatePtSetting( '22' ),
			]
		}
	} );

function generatePtSetting( size ) {
	return {
		model: size,
		title: size,
		view: {
			name: 'span',
			styles: {
				'font-size': `${ size }pt`
			}
		}
	};
}

In action:
selection_082

@jodator jodator closed this as completed Nov 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:question This issue asks a question (how to...).
Projects
None yet
Development

No branches or pull requests

2 participants