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

Create QuillToolbarSelectHeaderStyleDropdownButton #1575

Closed

Conversation

MacDeveloper1
Copy link
Contributor

@MacDeveloper1 MacDeveloper1 commented Dec 7, 2023

Description

The alternative widget QuillToolbarSelectHeaderStyleDropdownButton for heading style is created. Also the list of available headings is expanded to H6. So the new widget supports headings H1..H6. Font sizes,line heights and spacing are updated from this link. Basically standard HTML values are used.

P.S. Also some translations (uk and ru) are updated.

Images

image
image
image

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I titled the PR using Conventional Commits.
  • I did not modify the CHANGELOG.md nor the plugin version in pubspec.yaml files.
  • I have run the commands in ./scripts/before-push.sh and it all passed successfully

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (please indicate that with a ! in the title as explained in Conventional Commits).
  • No, this is not a breaking change.

@ellet0
Copy link
Collaborator

ellet0 commented Dec 7, 2023

Description

The alternative widget QuillToolbarSelectHeaderStyleDropdownButton for heading style is created. Also the list of available headings is expanded to H6. So the new widget supports headings H1..H6. Font sizes,line heights and spacing are updated from this link. Basically standard HTML values are used.

P.S. Also some translations (uk and ru) are updated.

Images

image image image

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I titled the PR using Conventional Commits.
  • I did not modify the CHANGELOG.md nor the plugin version in pubspec.yaml files.
  • I have run the commands in ./scripts/before-push.sh and it all passed successfully

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (please indicate that with a ! in the title as explained in Conventional Commits).
  • No, this is not a breaking change.

Hi, I appreciate your efforts but we already did that in the dev branch, we will look into some solution don't worry we will try to merge your PR

@ellet0
Copy link
Collaborator

ellet0 commented Dec 12, 2023

Description

The alternative widget QuillToolbarSelectHeaderStyleDropdownButton for heading style is created. Also the list of available headings is expanded to H6. So the new widget supports headings H1..H6. Font sizes,line heights and spacing are updated from this link. Basically standard HTML values are used.

P.S. Also some translations (uk and ru) are updated.

Images

image
image
image

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I titled the PR using Conventional Commits.
  • I did not modify the CHANGELOG.md nor the plugin version in pubspec.yaml files.
  • I have run the commands in ./scripts/before-push.sh and it all passed successfully

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (please indicate that with a ! in the title as explained in Conventional Commits).
  • No, this is not a breaking change.

Can you fix Ci failure by doing it aginst the latest master branch?

@ellet0
Copy link
Collaborator

ellet0 commented Dec 12, 2023

Besides the header styles for the new ones
We need to ask @singerdmx first because that's up this library is a port of react js so it needs to be the same otherwise quill delta will not work on quill js

And that's the whole idea behind the repo or the port

@MacDeveloper1
Copy link
Contributor Author

MacDeveloper1 commented Dec 13, 2023

@freshtechtips and @singerdmx I tested this new class and it works. See images. All headings are shown correctly. Qulll does not care on how many H is specified in configuration. Configuration is customizable.
Please look at this.
In any case this is new widget which does not affect the old one with H1...H3. ;)

@ellet0
Copy link
Collaborator

ellet0 commented Dec 13, 2023

@freshtechtips and @singerdmx I tested this new class and it works. See images. All headings are shown correctly. Qulll does not care on how many H is specified in configuration. Configuration is customizable.
Please look at this.

I'm not sure but I think you are right, but can at least do it with the new class that was added before you sent this PR but to the dev branch, and now it's merged with the master

@MacDeveloper1
Copy link
Contributor Author

The example code which I've just took from this.

var toolbarOptions = [
  ['bold', 'italic', 'underline', 'strike'],        // toggled buttons
  ['blockquote', 'code-block'],

  [{ 'header': 1 }, { 'header': 2 }],               // custom button values
  [{ 'list': 'ordered'}, { 'list': 'bullet' }],
  [{ 'script': 'sub'}, { 'script': 'super' }],      // superscript/subscript
  [{ 'indent': '-1'}, { 'indent': '+1' }],          // outdent/indent
  [{ 'direction': 'rtl' }],                         // text direction

  [{ 'size': ['small', false, 'large', 'huge'] }],  // custom dropdown
  [{ 'header': [1, 2, 3, 4, 5, 6, false] }],  // <------------------------------ headers

  [{ 'color': [] }, { 'background': [] }],          // dropdown with defaults from theme
  [{ 'font': [] }],
  [{ 'align': [] }],

  ['clean']                                         // remove formatting button
];

var quill = new Quill('#editor', {
  modules: {
    toolbar: toolbarOptions
  },
  theme: 'snow'
});

The aim of Quill I think is to keep rich text which can be converted to HTML which in its turn supports H1...H6.

@MacDeveloper1
Copy link
Contributor Author

but can at least do it with the new class that was added before you sent this PR but to the dev branch, and now it's merged with the master

It seems I didn't catch what do you mean.

@ellet0
Copy link
Collaborator

ellet0 commented Dec 13, 2023

The example code which I've just took from this.

var toolbarOptions = [
  ['bold', 'italic', 'underline', 'strike'],        // toggled buttons
  ['blockquote', 'code-block'],

  [{ 'header': 1 }, { 'header': 2 }],               // custom button values
  [{ 'list': 'ordered'}, { 'list': 'bullet' }],
  [{ 'script': 'sub'}, { 'script': 'super' }],      // superscript/subscript
  [{ 'indent': '-1'}, { 'indent': '+1' }],          // outdent/indent
  [{ 'direction': 'rtl' }],                         // text direction

  [{ 'size': ['small', false, 'large', 'huge'] }],  // custom dropdown
  [{ 'header': [1, 2, 3, 4, 5, 6, false] }],  // <------------------------------ headers

  [{ 'color': [] }, { 'background': [] }],          // dropdown with defaults from theme
  [{ 'font': [] }],
  [{ 'align': [] }],

  ['clean']                                         // remove formatting button
];

var quill = new Quill('#editor', {
  modules: {
    toolbar: toolbarOptions
  },
  theme: 'snow'
});

The aim of Quill I think is to keep rich text which can be converted to HTML which in its turn supports H1...H6.

Sure but that's not the problem, the problem we already have restored the deleted button from the past in 2022, I restored it with fewer features, and yours contains more features, do you want to fix the conflicts or let me handle it?

@MacDeveloper1
Copy link
Contributor Author

the problem we already have restored the deleted button from the past in 2022, I restored it with fewer features, and yours contains more features, do you want to fix the conflicts or let me handle it?

I will appreciate you if you can do this. And I think I could not do it by myself because of Only those with [write access] to this repository can merge pull requests. Resolve conflicts button is disabled for me.

@MacDeveloper1
Copy link
Contributor Author

MacDeveloper1 commented Dec 13, 2023

I think there are not many places of default package code which must be changed. The new widget and config are new files.

It is required to update Attributes to add new ones from H4 to H6 and expand switch statements to handle new headers. Also DefaultStyles are updated for H1...H6.

@ellet0
Copy link
Collaborator

ellet0 commented Dec 13, 2023

I think there are not many places of default package code which must be changed. The new widget and config are new files.

It is required to update Attributes to add new ones from H4 to H6 and expand switch statements to handle new headers. Also DefaultStyles are updated for H1...H6.

Do you want me to carry the changes to a separate PR or fetch and edit this PR? What do you prefer?
if you want me to choose I would choose the first because of the too many conflicts

@MacDeveloper1
Copy link
Contributor Author

MacDeveloper1 commented Dec 13, 2023

Do you want me to carry the changes to a separate PR or fetch and edit this PR? What do you prefer? if you want me to choose I would choose the first because of the too many conflicts

Please do as you feel comfortable. The important thing is correct work of my app which already uses this new widget my own branch. :)

@ellet0
Copy link
Collaborator

ellet0 commented Dec 13, 2023

Do you want me to carry the changes to a separate PR or fetch and edit this PR? What do you prefer? if you want me to choose I would choose the first because of the too many conflicts

Please do as you feel comfortable. The important thing is correct work of my app which already uses this new widget my own branch. :)

Just one thing, is the header styles always up to h6 from h1 or the developer can override it?

Comment on lines +639 to +648

/// No description provided for @normal.
///
/// In en, this message translates to:
/// **'Normal'**
String get normal => 'Normal';

/// No description provided for @heading1.
///
/// In en, this message translates to:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is auto-generated, please edit the the quill_en.arb instead
and run the script we mentioned in the development notes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry. I was to hurry. I think I can update translations after merge the PR with new widget.

Comment on lines +232 to 247
String get pickAPhotoFromYourGallery => 'Выберите фотографю из вашей галереи';

@override
String get takeAPhotoUsingYourCamera =>
'Take a photo using your phone camera';
'Создайте фотографю, использую фотокамеру';

@override
String get pasteAPhotoUsingALink => 'Paste a photo using a link';
String get pasteAPhotoUsingALink => 'Вставьте фотографию, используя ссылку';

@override
String get pickAVideoFromYourGallery => 'Pick a video from your gallery';
String get pickAVideoFromYourGallery => 'Выберете видео из вашей галереи';

@override
String get recordAVideoUsingYourCamera =>
'Record a video using your phone camera';
'Запишите видео, используя вдеокамеру';

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, you should update the quill_ru.arb file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.

Comment on lines +234 to +241
String get pickAPhotoFromYourGallery => 'Оберіть фотографію з вашої галереї';

@override
String get takeAPhotoUsingYourCamera =>
'Take a photo using your phone camera';
'Створіть фотографію, використовуючи фотокамеру';

@override
String get pasteAPhotoUsingALink => 'Paste a photo using a link';
String get pasteAPhotoUsingALink =>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quill_uk.arb file

Comment on lines +170 to +177
/// "attributes":{"header": 4 }
static const Attribute<int?> h4 = HeaderAttribute(level: 4);

/// "attributes":{"header": 5 }
static const Attribute<int?> h5 = HeaderAttribute(level: 5);

/// "attributes":{"header": 6 }
static const Attribute<int?> h6 = HeaderAttribute(level: 6);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@singerdmx
What do you think of this?

Comment on lines -223 to +256
color: defaultTextStyle.style.color!.withOpacity(0.70),
height: 1.15,
fontWeight: FontWeight.w300,
color: defaultTextStyle.style.color,
letterSpacing: -1,
height: 1,
fontWeight: FontWeight.bold,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May I ask why this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I added new heading I need to have som wide used values for heading so I searched the Internet and find a few links which suggest such values. The link with data which I used you may find in the start post.
Usually headers are used for highlighting some titles but opacity do the reading hard making usual text more higlighted then header. Usually defautt values for text black or white depending on theme brightness.

Comment on lines +264 to +268
fontSize: 30,
color: defaultTextStyle.style.color,
letterSpacing: -0.8,
height: 1.067,
fontWeight: FontWeight.bold,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new default values from HTML?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took the data from here

Get started with Boosted, a Bootstrap fork — the world’s most popular framework for building responsive, mobile-first sites, with jsDelivr and a template starter page.

.

This was referenced Dec 13, 2023
@ellet0
Copy link
Collaborator

ellet0 commented Dec 13, 2023

This pull request has been moved to

@MacDeveloper1
Copy link
Contributor Author

MacDeveloper1 commented Dec 13, 2023

Just one thing, is the header styles always up to h6 from h1 or the developer can override it?

It is fixed list from H1 to H6 and then Normal. I thought it is logical. It is shown in the image I post in start topic.

@ellet0
Copy link
Collaborator

ellet0 commented Dec 13, 2023

Just one thing, is the header styles always up to h6 from h1 or the developer can override it?

It is fixed list from H1 to H6 and then Normal. I thought it is logical. It is shown in the image I post in start topic.

I add the ability to edit it

@MacDeveloper1
Copy link
Contributor Author

MacDeveloper1 commented Dec 13, 2023

I add the ability to edit it

Why do think it is necessary? To place more large font somewhere in middle? I think it not good idea. Or do you mean moving only Normal options to top or bottom?

@ellet0
Copy link
Collaborator

ellet0 commented Dec 13, 2023

I add the ability to edit it

Why do think it is necessary? To place more large font somewhere in middle? Or do you mean moving only Normal options to top or bottom?

No, it's just one variable, which is a list that has default value, and you can change it back to previous value, it's necessary otherwise this can be considered as a breaking change

@ellet0
Copy link
Collaborator

ellet0 commented Dec 16, 2023

We already carried the changes of this PR, thank you

@ellet0 ellet0 closed this Dec 16, 2023
MacDeveloper1 added a commit to MacDeveloper1/flutter-quill that referenced this pull request Dec 19, 2023
ellet0 added a commit that referenced this pull request Dec 19, 2023
* Restore correct feel&look of `QuillToolbarIconButton`

* Export `QuillToolbarSelectAlignmentButtons`

* Restore old call of `QuillToolbarIconButton`

* Restore old call of `QuillToolbarIconButton`

* Resore original button PR #1575

* Restore old feel&look of buttons

* Restore original `QuillToolbarSelectAlignmentButton`

* Restore original `QuillToolbarLinkStyleButton2`

* Make `options` optional

* Restore old `QuillToolbarFontFamilyButton` build

* Restore old build of `QuillToolbarFontSizeButton`

* Change `textStyle` to `style`

* Remove redundant export

---------

Co-authored-by: Ellet Hnewa <73608287+ellet0@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

None yet

2 participants