البرمجة

كيفية إضافة أحجام خط مخصصة في QuillJS

To add custom font sizes to the QuillJS editor, you need to define the custom sizes in the toolbarOptions and ensure that they are supported by QuillJS. Here’s a step-by-step guide to adding custom font sizes:

  1. Define the custom font sizes in the toolbarOptions array:

    javascript
    let toolbarOptions = [ ['bold', 'italic', 'underline', 'strike'], [{ 'align': [] }], [{ 'size': ['small', false, 'large', 'huge'] }], // Define the custom sizes here [{ 'color': ['#FFF'] }] ];
  2. Initialize the Quill editor with the defined toolbarOptions:

    javascript
    this.editor = new Quill('#executive-control-editor', { modules: { toolbar: toolbarOptions }, theme: 'snow' });
  3. In the second approach you provided, ensure that the ql-size class is correctly linked to the custom sizes in the toolbarOptions.

By following these steps, you should be able to add custom font sizes to the QuillJS editor’s toolbar. If you encounter any issues, make sure to check the QuillJS documentation for the correct implementation of custom sizes.

المزيد من المعلومات

لإضافة أحجام خط مخصصة إلى محرر QuillJS ، يجب عليك تعريف الأحجام المخصصة في مصفوفة toolbarOptions والتأكد من أنها مدعومة من قبل QuillJS. إليك دليل تفصيلي على كيفية إضافة أحجام الخط المخصصة:

  1. قم بتعريف أحجام الخط المخصصة في مصفوفة toolbarOptions:

    javascript
    let toolbarOptions = [ ['bold', 'italic', 'underline', 'strike'], [{ 'align': [] }], [{ 'size': ['small', false, 'large', 'huge'] }], // Define the custom sizes here [{ 'color': ['#FFF'] }] ];
  2. قم بتهيئة محرر Quill مع toolbarOptions المحددة:

    javascript
    this.editor = new Quill('#executive-control-editor', { modules: { toolbar: toolbarOptions }, theme: 'snow' });
  3. في الطريقة الثانية التي قدمتها ، تأكد من أن الفئة ql-size مرتبطة بشكل صحيح بالأحجام المخصصة في toolbarOptions.

من خلال اتباع هذه الخطوات ، يجب أن تكون قادرًا على إضافة أحجام خط مخصصة إلى شريط أدوات محرر QuillJS. إذا واجهت أي مشاكل ، تأكد من التحقق من توثيق QuillJS للتنفيذ الصحيح للأحجام المخصصة.

زر الذهاب إلى الأعلى