Skip to content

Conversation

@anuragteapot
Copy link
Contributor

@anuragteapot anuragteapot commented Jun 7, 2018

Pull Request for Issue #20679

Summary of Changes

As @okonomiyaki3000 Suggested to remove the fullscreen message. I removed it.

Testing Instructions

  1. Set default editor to codemirror in global configuration.

  2. Open com_content and start creating an article. See, that there are no errors in web console.

  3. Open the file administrator/components/com_content/forms/article.xml and the text

<field
name="articletext2"
type="editor"
label="COM_CONTENT_FIELD_ARTICLETEXT_LABEL"
filter="JComponentHelper::filterText"
buttons="true"
/>

after the field with the name articletext

4 . Open file
/administrator/components/com_content/tmpl/article/edit.php

and add the text

<?php echo $this->form->getInput('articletext2'); ?>

after the text

<?php echo $this->form->getInput('articletext'); ?>

Expected result

No error in console.

Fix codemirror as a customelements .
Credit goes to @dgrammatiko #20679 (comment)

Actual result

/media/vendor/codemirror/mode/text/html/text/html.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)

@anuragteapot anuragteapot requested a review from brianteeman as a code owner June 7, 2018 11:49
@joomla-cms-bot joomla-cms-bot added Language Change This is for Translators PR-4.0-dev labels Jun 7, 2018
'Esc': that.closeFullScreen,
};

editor.addKeyMap(map);

Choose a reason for hiding this comment

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

Expected indentation of 14 spaces but found 7 tabs indent
Unexpected tab character no-tabs

"Ctrl-Q": that.toggleFullScreen,
[that.getAttribute('fs-combo')]: that.toggleFullScreen,
'Esc': that.closeFullScreen,
};

Choose a reason for hiding this comment

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

Expected indentation of 14 spaces but found 7 tabs indent
Unexpected tab character no-tabs

const map = {
"Ctrl-Q": that.toggleFullScreen,
[that.getAttribute('fs-combo')]: that.toggleFullScreen,
'Esc': that.closeFullScreen,

Choose a reason for hiding this comment

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

Expected indentation of 16 spaces but found 8 tabs indent
Unexpected tab character no-tabs
Unnecessarily quoted property 'Esc' found quote-props


const map = {
"Ctrl-Q": that.toggleFullScreen,
[that.getAttribute('fs-combo')]: that.toggleFullScreen,

Choose a reason for hiding this comment

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

Expected indentation of 16 spaces but found 8 tabs indent
Unexpected tab character no-tabs

}

const map = {
"Ctrl-Q": that.toggleFullScreen,

Choose a reason for hiding this comment

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

Expected indentation of 16 spaces but found 8 tabs indent
Unexpected tab character no-tabs
Strings must use singlequote quotes

case 'options':
if (oldValue && newValue !== oldValue) {
this.refresh(this.element);
}

Choose a reason for hiding this comment

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

Expected indentation of 8 spaces but found 3 tabs indent
Unexpected tab character no-tabs

switch (attr) {
case 'options':
if (oldValue && newValue !== oldValue) {
this.refresh(this.element);

Choose a reason for hiding this comment

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

Expected indentation of 10 spaces but found 4 tabs indent
Unexpected tab character no-tabs

attributeChangedCallback(attr, oldValue, newValue) {
switch (attr) {
case 'options':
if (oldValue && newValue !== oldValue) {

Choose a reason for hiding this comment

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

Expected indentation of 8 spaces but found 3 tabs indent
Unexpected tab character no-tabs


attributeChangedCallback(attr, oldValue, newValue) {
switch (attr) {
case 'options':

Choose a reason for hiding this comment

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

Expected indentation of 6 spaces but found 3 tabs indent
Unexpected tab character no-tabs

set options(value) { this.setAttribute('options', value); }

attributeChangedCallback(attr, oldValue, newValue) {
switch (attr) {

Choose a reason for hiding this comment

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

Expected indentation of 4 spaces but found 2 tabs indent
Unexpected tab character no-tabs
Expected a default case default-case

Copy link
Contributor

@brianteeman brianteeman left a comment

Choose a reason for hiding this comment

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

language string approved

@laoneo laoneo changed the title Fix Codemirror as a custom elements [4.0] Fix Codemirror as a custom elements Jun 7, 2018
this.instance.setOption('fullScreen', false);
}

makeMarker() {

Choose a reason for hiding this comment

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

Expected 'this' to be used by class method 'makeMarker' class-methods-use-this

}
} else {
while (typeof window[string1] !== 'function') {
await this.rafAsync();

Choose a reason for hiding this comment

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

Unexpected await inside a loop no-await-in-loop

async checkElement(string1, string2) {
if (string2) {
while (typeof window[string1][string2] !== 'function') {
await this.rafAsync();

Choose a reason for hiding this comment

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

Unexpected await inside a loop no-await-in-loop

}

rafAsync() {
return new Promise(resolve => {

Choose a reason for hiding this comment

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

Expected parentheses around arrow function argument having a body with curly braces arrow-parens

this.instance = window.CodeMirror.fromTextArea(element, this.options);
}

rafAsync() {

Choose a reason for hiding this comment

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

Expected 'this' to be used by class method 'rafAsync' class-methods-use-this

}
} else {
while (typeof window[string1] !== 'function') {
await this.rafAsync();

Choose a reason for hiding this comment

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

Unexpected await inside a loop no-await-in-loop

async checkElement(string1, string2) {
if (string2) {
while (typeof window[string1][string2] !== 'function') {
await this.rafAsync();

Choose a reason for hiding this comment

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

Unexpected await inside a loop no-await-in-loop

this.instance = window.CodeMirror.fromTextArea(element, this.options);
}

rafAsync() {

Choose a reason for hiding this comment

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

Expected 'this' to be used by class method 'rafAsync' class-methods-use-this

@anuragteapot
Copy link
Contributor Author

anuragteapot commented Jun 7, 2018

@dgrammatiko Please take a look in the code I have done some changes.

@anuragteapot
Copy link
Contributor Author

And, also on eslint codestyle issue . Thanks

@astridx
Copy link
Contributor

astridx commented Jun 7, 2018

I have tested this item ✅ successfully on c8da110


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20684.

@astridx
Copy link
Contributor

astridx commented Jun 7, 2018

I saw no error in console and the language string is changed like explained. I would only suggest to change the language string into something like this:
"In read only mode, a full screen is not possible"
Because the full screen does not open in read only mode.

If more than one editor is in write mode (no read only) on the page, the F10 key opens the editor where the cursor is currently located.

@laoneo
Copy link
Member

laoneo commented Jun 8, 2018

Can you also have a look on the remaining three hound issues?

@anuragteapot
Copy link
Contributor Author

@laoneo Done!

@laoneo
Copy link
Member

laoneo commented Jun 11, 2018

@okonomiyaki3000 can you please test this pr as you are the code mirror expert? Thanks.

@anuragteapot
Copy link
Contributor Author

anuragteapot commented Jun 11, 2018

@brianteeman Can you please check language string? Thanks

@brianteeman
Copy link
Contributor

I already have :)

@okonomiyaki3000
Copy link
Contributor

okonomiyaki3000 commented Jun 14, 2018

A few problems still:

  • The theme selector lists all themes twice. Once normally and once as .min.
  • After saving the plugin options, the editor is broken. Console says Uncaught SyntaxError: Unexpected token <
  • When editing a php file, there seems to be something wrong with syntax highlighting and the html part doesn't do things like tag completion. (now that I try it, this might be broken in the J3 version too...)

@okonomiyaki3000
Copy link
Contributor

Ah, and it's a little out of date. The appearance options tab should show a preview of what the editor will look like with the current settings.

@okonomiyaki3000
Copy link
Contributor

Oh and why not just remove that silly fullscreen message? I added it in the first place because I was changing the fullscreen hotkey from ctrl-q (seriously, who thought that was a good idea?) to something configurable but I figured that after a while we could remove it. People must have adjusted to the change by now, right?

@okonomiyaki3000
Copy link
Contributor

You may like to see #20746 for a way to fix my third point above.

@laoneo
Copy link
Member

laoneo commented Jun 14, 2018

@Anu1601CS can you have a look on the two first issues from @okonomiyaki3000. Thanks.

@anuragteapot
Copy link
Contributor Author

@laoneo I will take a look on it.

@anuragteapot
Copy link
Contributor Author

A few problems still:

The theme selector lists all themes twice. Once normally and once as .min.
After saving the plugin options, the editor is broken. Console says Uncaught SyntaxError: Unexpected token <
When editing a php file, there seems to be something wrong with syntax highlighting and the HTML part doesn't do things like tag completion. (now that I try it, this might be broken in the J3 version too...)

@okonomiyaki3000 Can you please share the testing instruction?

And, what you want to do in fullscreen message ?

@okonomiyaki3000
Copy link
Contributor

The theme selector is in the plugin settings in the appearance tab. It's just a list of themes.

If you run the editor with ever having saved any options, it works. When you open the plugin settings and then save, all pages with codemirror on them will have errors.

To see the syntax highlighting issue, just open any php file with code mirror.

For the fullscreen message, I just think we don't need it at all. It doesn't make much sense. If we need to put instructions for using CodeMirror there, we should have a lot more than just that one item but why should we? We don't list instructions for other things.

@anuragteapot
Copy link
Contributor Author

@okonomiyaki3000 As you suggested #20746 to fix mode, it works fine and syntax highlight is also good. But, one problem is still present, if two codemirror editor is present in a same page, then we are only able to toggle last codemirror to fullscreen ( only one codemirror makes toggle) .

@anuragteapot
Copy link
Contributor Author

@okonomiyaki3000 Seems like i found solution of fullscreen.
And, should i remove fullscreen message for both ?

@okonomiyaki3000
Copy link
Contributor

I'm not really the one to ask. I never liked the message at all. I'm sure someone must have asked me to put it there but it was so long ago... So, personally, I'd love to see it gone. If nobody else objects...

@astridx
Copy link
Contributor

astridx commented Jun 22, 2018

I have tested this item ✅ successfully on f663276


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20684.

@astridx
Copy link
Contributor

astridx commented Jun 22, 2018

I saw no error in console. I saw no full screen message. I like it, that there is no full screen message. I think it is confusing if there is more than one editor on a page. If people see the text "click F10 to open full-screen" more than one time, they will be wondering which editor will be opened.

If more than one editor is in write mode (no read only) on the page, the F10 key opens still the editor where the cursor is currently located. I think this is OK, because so people who know this feature from the past, can still use it.

@dgrammatiko
Copy link
Contributor

I have tested this item ✅ successfully on f663276


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20684.

@anuragteapot
Copy link
Contributor Author

Thanks @dgrammatiko

@ghost
Copy link

ghost commented Jun 22, 2018

Ready to Commit after two successful tests.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Jun 22, 2018
@laoneo laoneo merged commit af62faf into joomla:4.0-dev Jun 22, 2018
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Jun 22, 2018
@laoneo
Copy link
Member

laoneo commented Jun 22, 2018

Nice one, thanks all involved.

@laoneo laoneo added this to the Joomla 4.0 milestone Jun 22, 2018
@anuragteapot anuragteapot deleted the codemirror branch June 22, 2018 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Language Change This is for Translators

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants