-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Remove Ivy Codemirror #14659
Remove Ivy Codemirror #14659
Conversation
*/ | ||
|
||
const JSON_EDITOR_DEFAULTS = { | ||
// IMPORTANT: `gutters` must come before `lint` since the presence of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved comment to the modifier.
@@ -168,31 +168,12 @@ $gutter-grey: #2a2f36; | |||
} | |||
|
|||
.readonly-codemirror { | |||
.CodeMirror-cursors { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was not working. We have it working now under a new class that only shows if the editor is readOnly.
@@ -2,7 +2,10 @@ | |||
<JsonEditor | |||
@showToolbar={{false}} | |||
@value={{stringify this.content}} | |||
@options={{hash readOnly=true lineNumbers=false autoHeight=true gutters=false theme="hashi auto-height"}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all options objects were spread out so that the individual properties were sent to the json-editor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not seeing autoHeight
as an arg. Is the codemirror default true
and is that something we won't ever want to set to false
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. I removed this because before it was used to set the viewportMargin. See here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh ok I see now thanks!
@@ -19,8 +19,7 @@ module('Integration | Component | console/log json', function (hooks) { | |||
this.set('content', objectContent); | |||
|
|||
await render(hbs`{{console/log-json content=content}}`); | |||
const instance = this.codeMirror.instanceFor(find('[data-test-component=json-editor]').id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this old way of selecting the codemirror instance no longer works. I suspect because we're initializing it through a modifier instead of on the component via ivycodemirror.
@@ -26,10 +26,6 @@ const appConfig = { | |||
return `${config.rootURL.replace(/\/$/, '')}${filePath}`; | |||
}, | |||
}, | |||
codemirror: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
everything removed from this file was added into the modifier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work on this thanks! Small wording issue on a comment and I wanted to get your thoughts on the mode
arg before approving.
ui/app/components/json-editor.js
Outdated
* @param {object} [options] - option object that overrides codemirror default options such as the styling. | ||
* @param {Object} [extraKeys] - to provide keyboard shortcut methods for things like saving on shift + enter. | ||
* @param {Array} [gutters] - An array of CSS class names or class name / CSS string pairs, each of which defines a width (and optionally a background), and which will be used to draw the background of the gutters. | ||
* @param {string} [mode] - right now we only import ruby so must mode but be ruby or defaults to javascript. If you wanted another language you need to import it into the modifier. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nit on the comment wording. Also, from reading it I'm wondering since ruby and application/json are the only supported modes at this time could the arg change to useRubyMode
or something like that? If true the mode
is set to ruby
otherwise application/json
is used. What are your thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a valid question. I think however I prefer mode because it aligns with the codemirror property. It would be easy for someone to look up. I also don't want someone to think they only can use Ruby in the future. They can use lots of other options they just need to import it. They'll immediately error to if they use something other than ruby.
I'll amend the comment wording.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good so if I were to pass in php
right now for example codemirror
would throw an error since it's not imported?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct, it wouldn't work.
// `gutters` is cached internally when `lint` is toggled | ||
gutters: this.args.named.gutters || ['CodeMirror-lint-markers'], | ||
matchBrackets: true, | ||
lint: { lintOnChange: true }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous version of JsonEditor
had lintOnChange
defaulted to false
. Just want to verify that we want that as true
in the new version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. This was left over from me playing with the linting. I'll change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, strange. I changed back and it broke the linter. Let me investigate a little tomorrow because we are calling performLint() so we shouldn't need this.
@@ -2,7 +2,10 @@ | |||
<JsonEditor | |||
@showToolbar={{false}} | |||
@value={{stringify this.content}} | |||
@options={{hash readOnly=true lineNumbers=false autoHeight=true gutters=false theme="hashi auto-height"}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not seeing autoHeight
as an arg. Is the codemirror default true
and is that something we won't ever want to set to false
?
Replacing the deprecated ivycodemirror with an ember modifier. See Deprecation and instructions here.
Notes:
Screen.Recording.2022-03-28.at.11.54.53.AM.mp4