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

Code formatting in page editor #53

Open
KoljaL opened this issue Aug 30, 2022 · 6 comments
Open

Code formatting in page editor #53

KoljaL opened this issue Aug 30, 2022 · 6 comments
Labels
enhancement New feature or request

Comments

@KoljaL
Copy link

KoljaL commented Aug 30, 2022

Great plugin, thanks a lot for this.

I am using WordPress 6.0.1 and have disabled the block editor.
add_filter('use_block_editor_for_post', '__return_false', 10);

Unfortunately, the formatting in the classic editor (post & pages) does not work.

grafik

Is there any way I can force this?

Greetings Kolja

edit:
I noticed that the comments are created with // and this file is loaded:
/build/lib/monaco-editor/min/vs/basic-languages/php/php.js

Can it be that the wrong language is loaded in the page editor?

@t-hamano
Copy link
Owner

What does "formatting" mean? Are you talking about the action of tagging the selected text with a button such as ul or ol, or about indentation with the Tab key?

Either way, first check to see if it works as expected with this plugin turned off.

@KoljaL
Copy link
Author

KoljaL commented Aug 30, 2022

Somewhere this function is called "beautify" 😃

@t-hamano
Copy link
Owner

This plugin does not have such functionality to begin with.

@KoljaL
Copy link
Author

KoljaL commented Aug 30, 2022

Hi t-hamano,
I don't think I've managed to describe what I mean to you yet. Sorry.

In all the examples of your plugin the code is always correctly indented and also in the settings I can set the indentation (Tabs or Spaces).

When I write HTML code on the page editor and indent it manually, it slides back to the left side after saving (as in the screenshot in my first post).

So I thought it might be possible to restore this indentation so that it looks again like in the examples.

In the settings for the context menu, I found this image:

grafik

Unfortunately, the entry Format Document does not exist for me.

@t-hamano
Copy link
Owner

When I write HTML code on the page editor and indent it manually, it slides back to the left side after saving (as in the screenshot in my first post).

This does not seem to be a problem with this plugin.
When you turn off the plugin and indent (by pressing the space key) on the default editor, do the spaces remain after saving?

In the settings for the context menu, I found this image:

Oh, it exists in the context menu.
That might be able to handle it, and I will consider that in a future update.

@t-hamano t-hamano added the enhancement New feature or request label Jan 26, 2023
@t-hamano
Copy link
Owner

Technically it is possible to implement a formatter, but I need to consider which formatter library to use. This will take some time, so remove the WP6.4 label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants