1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00
Commit graph

7 commits

Author SHA1 Message Date
Kevin Ansfield d6058dbf27 Co-located component template files
no issue

Keeps component JS backing files and template files in the same directory which avoids hunting across directories when working with components. Also lets you see all components when looking at one directory, whereas previously template-only or js-only components may not have been obvious without looking at both directories.

- ran [codemod](https://github.com/ember-codemods/ember-component-template-colocation-migrator/) for app-level components
- manually moved in-repo-addon component templates in `lib/koenig-editor`
- removed all explicit `layout` imports as JS/template associations are now made at build-time removing the need for them
- updated `.embercli` to default to new flat component structure
2020-05-18 13:14:08 +01:00
Kevin Ansfield f529296129
Migrated to <AngleBracketSyntax /> (#1460)
no issue

Ember is migrating to `<AngleBracketSyntax />` for component invocation, see https://github.com/emberjs/rfcs/blob/master/text/0311-angle-bracket-invocation.md

We were in a half-way situation where some templates used angle bracket syntax in some places, this PR updates templates to use the syntax everywhere.

This simplifies the rules for what template code is referring to...

`<Component>` = a component
`{{helper}}` = a helper (or locally assigned handlebars variable)
`{{this.foo}}` = data on the template backing context (a component/controller)
`{{@foo}}` = a named argument passed into the component that the component backing class has not modified (note: this commit does not introduce any named arguments)

- ran codemod https://github.com/ember-codemods/ember-angle-brackets-codemod on the following directories:
  - `app/templates`
  - `lib/koenig-editor/addon/templates`
- removed positional params from components as angle bracket syntax does not support them
  - `gh-feature-flag`
  - `gh-tour-item`
  - `gh-cm-editor`
  - `gh-fullscreen-modal`
  - `gh-task-button`
- updates some code that was missed in aaf9f88ebc to use explicit this
2020-01-16 15:14:03 +00:00
Kevin Ansfield aaf9f88ebc Ran "no implicit this in templates" codemod
no issue

We were in a part-way state where some touched files had been (sometimes partially) migrated to explicit `this`. The codemod that was available has now fixed the formatting issues it had so it was a good time to run it.

https://github.com/ember-codemods/ember-no-implicit-this-codemod

- part of the migration path for https://github.com/emberjs/rfcs/pull/308
- starts to make template resolution rules more explicit
  - `<MyComponent />` - always a component
  - `{{my-component}}` - component or helper (components _must_ have a `-`. This style of component will go away once fully migrated to angle bracket components)
  - `{{value}}` - a helper or local template variable
  - `{{this.value}}` - reference to a property on the backing context (either a controller or a component JS file)
2019-12-13 14:20:29 +00:00
Kevin Ansfield 232cd9382b
Added language selection to code cards (#1180)
no issue

- Added a language indicator when in rendered mode and a language input when in edit mode
- Allow code card language to be set with <code>```lang</code>+<kbd>Space/Enter</kbd> expansion 
    - previously <code>\`\`\`</code> would immediately create a code card, the <kbd>Space/Enter</kbd> is now necessary for the insertion to occur
    - lang is optional <code>\`\`\`</code>+<kbd>Space/Enter</kbd> will insert a code card with no language selected
    - requires <kbd>Enter</kbd> to be pressed to finalise the expansion and insert the card
    - added hook for text expansions to skip newline creation for when they are triggered with <kbd>Enter</kbd>
- Set the code card editor's language mode based on selected language
    - set the CodeMirror mode based on the code card payload language
        - add a basic map of language short codes to their respective CodeMirror modes
    - observe `mode` property in `{{gh-cm-editor}}` so that the mode is properly set when it's changed after initial render
2019-04-30 16:46:29 +02:00
Kevin Ansfield 5727dc8ed5 🐛 Fixed Code Injection inputs not being clickable
no issue
- attempt to fix the "Cannot set property 'modeOption' of undefined" error by telling CM to replace the textarea element rather than appending to the wrapper and having Ember replace the textarea
2019-02-22 10:52:32 +07:00
Kevin Ansfield 479b187ac0
Remove ember-one-way-controls (#959)
closes https://github.com/TryGhost/Ghost/issues/9386
- remove usage of `{{one-way-checkbox}}` in favour of direct HTML+handlebars
- add `{{gh-text-input}}` that inherits from Ember's built-in `TextInput` component along with our custom `TextInput` mixin
- swap all uses of `{{gh-input}}` for `{{gh-text-input}}
- remove `{{gh-input}}` component
- update `{{gh-textarea}}` to inherit from Ember's `TextArea` component instead of `OneWayTextarea` and update all component uses accordingly
- update `{{gh-trim-focus-input}}` to inherit from `{{gh-text-input}}` and update all component uses accordingly
- standardize on using the `focus-out` action naming rather than `focusOut` for all text inputs, this is because the text input components (especially `{{gh-trim-focus-input}}`) have their own `focusOut` handler which gets overridden if consumers supply their own `focusOut` attr
- drop `ember-one-way-controls` package
- add `ember-one-way-select` package
2018-02-28 11:44:03 +00:00
Kevin Ansfield 3139b23258
🎨 Improved code injection loading behaviour on slow connections (#935)
closes https://github.com/TryGhost/Ghost/issues/9249
- in `{{gh-cm-editor}}` display a standard textarea in place of the CodeMirror editor whilst CodeMirror assets are loading in the background, textarea will be upgraded to a CodeMirror editor when loading finishes
- update styles so that the switch from plain textarea to CodeMirror is not too jarring
2018-01-02 18:29:03 +00:00