Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#14830 closed New Feature (wontfix)

Sourcearea: Keep buttons available while activated

Reported by: brunoais Owned by:
Priority: Normal Milestone:
Component: General Version: 4.4.7
Keywords: Cc:

Description

When the sourcearea plugin is activated, all CKE buttons that relate to editing the content become disabled.
Instead,
I suggest to change the plugin so that actions can be executed to each button while in this mode.
E.g.:

  • Allow "b" button to place "<b></b>" tags around the selected content.
  • Allow "blockquote" to place "<blockquote></blockquote>" tags around the selected content.

etc...

Also allow it to be configured such that if the BBCode plugin is used with the source plugin, the tags can be changed to something else.

Feel free to ask anything you need.

Change History (5)

comment:1 Changed 3 years ago by Jakub Ś

Status: newpending

Also allow it to be configured such that if the BBCode plugin is used with the source plugin,

I don't think I will be possible to implement this part because it would require dependencies between unrelated plugins and we don’t want to have such dependencies.

Allow "b" button to place "<b></b>" tags around the selected content.

This sounds like an interesting idea but it is not as easy as it looks. What if someone tries to select content and insert blockquote like so <blockquote><p>test</blockquote> test</p>? What should happen then? Should CKEditor fix this in source mode or just allow this junk and let it be fixed in wysiwtg mode? What if end result in wysiwyg mode is not what user wanted? This is just one example but there are others like <p><blockquote>test</blockquote> test</p> or <span style="color:red;"><p>test</span> test</p>.

The idea is really great but I just can’t see it. I don't see fixing HTML in source mode.

@brunoais could you comment on this?

comment:2 Changed 3 years ago by brunoais

Although those are good points, I hope this can help you understand.

1st:
The BBCode plugin and this plugin are separate. So, they should be configured separately. This means that, for each button that exists, a separate configuration for the source plugin is required on what is inserted as it is pressed.
For that, I'd like having a method API for setting the association between the button and the action.
CKE may be shipped with some buttons configured with HTML and then, for example, the BBCode plugin may call that same API to replace those "defaults" or even remove some button effects. The user's code can then come and decide the final work of each button press. (feel free to ask for more here, if you are unsure).

2nd:
That issue already exists and Sourcearea implementers have already made a decision on how to act on it. The buttons should only be shortcuts for typing out the HTML/BBCode/Markdown, etc...
What do you do currently if a user is given the HTML <blockquote><p>test test</blockquote></p> and he changes to <blockquote><p>test</blockquote> test</p>?
If you had already made that design decision, I think it can just stay like it has been.
There's no need to do HTML validation in source code mode and I believe most people that uses it, don't expect such thing to happen anyway.

Thank you for the attention.

comment:3 Changed 3 years ago by brunoais

Did you understand, j.swiderski? Need help with anything else?

comment:4 Changed 3 years ago by Marek Lewandowski

Resolution: wontfix
Status: pendingclosed

It's a nice idea, but the implementation would take substantial amount of time.

The good news is that there are already tools in place for this. You could listen to editor mode change event, you could also modify existing command definitions, to make them work in different mode, and you could also listen to command event itself to provide custom implementation in given circumstances.

So my suggestion would be to experiment a little bit, by adding a custom plugin that adds such functionallity on top of existing core plugins. E.g. sourcebasicstyles and, if enabled, it would bring integration for basicstyles with sourcearea.

With that in mind, we know that very little of our user base would benefit from this feature, that's we're looking to put our effort in general tickets. Still, we can see it working for this handful group of power users, and CKEditor API has already tools in place to make it happen, so it would be great for community to collaborate and create such plugin and publish it in CKEditor add-ons repository.

comment:5 Changed 3 years ago by brunoais

OK. Thank you for the insight and for giving all the basics on this.

I'll do some investigation on my slim time time and decide if I can do this. Afterwards, if all goes well (and I hope it goes well), I'll implement this as an addon to CKE.

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy