Commit Graph

4102 Commits

Author SHA1 Message Date
Kevin Ansfield af5ac2aa13 Koenig - Fixed error on Cmd+K with no selection
refs https://github.com/TryGhost/Ghost/issues/9505
2018-05-22 14:01:03 +01:00
Chris Thoburn 47d91aa910 Don't fingerprint assets in development (dev perf fix) (#1018)
no issue
- doing so causes a double pass through asset-rewrite and forces both to take much longer. This cuts 3s off of rebuilds.  Using asset-rewrite as is done in dev mode is also suspicious, likely a better setup could be devised that doesnt require rewrite to interop with the local ghost server
2018-05-21 09:37:17 +01:00
Kevin Ansfield 712d707dbd Koenig - Grab image caption from <img><figcaption> when pasting
refs https://github.com/TryGhost/Ghost/issues/9623
- workaround to grab a `<figcaption>` for use in an image card in some cases
- will only work when an `<img>` tag is immediately followed by a `<figcaption>` tag in the parsed html
2018-05-18 14:26:26 +01:00
Kevin Ansfield 306a099f07 Koenig - Convert <pre><code> to code card
refs https://github.com/TryGhost/Ghost/issues/9623
- add parser plugin to match a `<pre>` with a nested `<code>` as it's first child and transform it into a code card
2018-05-18 14:06:35 +01:00
Kevin Ansfield b4ef8129a6 Koenig - Convert pasted <img> and <hr> elements to cards
refs https://github.com/TryGhost/Ghost/issues/9623
- use our custom paste event to intercept and modify pasted HTML before passing to mobiledoc
  - wrap the html in a `<div>` so that all elements get parsed by mobiledoc-kit
- when pasting results in the last pasted section being a card, insert a blank paragraph
  - fixes immediate breaking of the undo stack
2018-05-18 13:55:46 +01:00
Kevin Ansfield 4370f33089 Koenig - Convert <br>s to soft-break atoms on paste
refs https://github.com/TryGhost/Ghost/issues/9623
- adds `parserPlugins` option with array of parser plugins that read node values and convert them when pasting
- converts `<br>` to a soft-break atom for line breaks
- removes leading newlines from text nodes to avoid leading spaces in the render output (common when pasting MD with line breaks)
2018-05-17 16:46:25 +01:00
Kevin Ansfield faba3f59e2 Fix tests
no issue
- 150f68e826 contained a wording change that was not taken into account in the tests
2018-05-17 15:18:09 +01:00
Kevin Ansfield 4b45a95cd4 Koenig - Fixed header toggle via toolbar
refs https://github.com/TryGhost/Ghost/issues/9623
- header text expansion skip for headers with the same level didn't take into account that the toolbar should actually toggle the heading on/off
2018-05-17 15:00:43 +01:00
Kevin Ansfield 914c50b468 Koenig - Standardise <b> and <i> elements when pasting
refs https://github.com/TryGhost/Ghost/issues/9623
- use our paste handler to perform a replacement on any pasted HTML
  - `<b>` -> `<strong>`
  - `<i>` -> `<em>`
2018-05-17 14:42:20 +01:00
Kevin Ansfield 5a3acaa967 Koenig - Fixed errors when dragging selection
refs https://github.com/TryGhost/Ghost/issues/9623
- catches and ignores `editor.positionAtPoint` TypeError due to not having a correct node value whilst dragging with a selection
- fixes error thrown from the triple-click handling which expected a value to always be present
2018-05-17 13:56:37 +01:00
Zimo cdee31b2fd Koenig - Added Code Block card to (+) and / menus
refs https://github.com/TryGhost/Ghost/issues/9623
- added code block card to (+) and / menus
- changed card row length to 3
- swapped html icon for code icon and added new html icon
2018-05-17 12:20:02 +01:00
Zimo 150f68e826 Koenig Editor Beta Release
refs https://github.com/TryGhost/Ghost/issues/9505
- see https://forum.ghost.org/t/koenig-beta-release/1284 for full details
- moved Koenig editor checkbox from experimental to Beta
- added info message support in editor screen
- removed alert when opening markdown-incompatible post with Koenig disabled
2018-05-17 12:01:00 +01:00
Kevin Ansfield 296fe295db Bump Spirit dependency
no issue
- tweaks for Koenig beta release
2018-05-17 11:43:21 +01:00
Kevin Ansfield db00d89541 Koenig - Remove duplication in special format edit state toggling
refs https://github.com/TryGhost/Ghost/issues/9623
2018-05-17 10:47:44 +01:00
Kevin Ansfield 37dbc7f6e8 Koenig - Fixed error when placing cursor on special formats after pasting
refs https://github.com/TryGhost/Ghost/issues/9623
- fixes `Maximum call stack size exceeded` error when you paste content containing `<code>` elements and then place the cursor at the end of one of those elements
  - this was occurring because the code in `inputModeDidChange()` was triggering another `inputModeDidChange() call
- use the private mobiledoc-kit methods to toggle editor state because we don't want to trigger `inputModeDidChange()` callbacks
- look at the editor state directly rather than going by what we _think_ the editor state should be based on the markers around the cursor
- fixes another subtle issue where after pasting if you placed the cursor at the end of the code format and started typing it would still be formatted as code - mobiledoc-kit has an odd behaviour where duplicate edit states for the markup are present so we have to loop over them rather than relying on a single `toggleMarkupState()` call
2018-05-16 17:21:34 +01:00
Kevin Ansfield e1b420919f Koenig - Parse pasted plain text as markdown
refs https://github.com/TryGhost/Ghost/issues/9623
- plain text that's pasted will be run through our markdown parser then mobiledoc-kit will perform it's usual rich-text paste handling on the resulting HTML
- add a <kbd>Cmd/Ctrl+V+Shift</kbd> escape valve that will skip markdown parsing so mobiledoc-kit's default plain text parsing is invoked
- will not work with IE or Edge <= 16 due to missing browser support for distinguishing plain text vs html pastes
2018-05-16 13:08:11 +01:00
Kevin Ansfield 6353d713e7 Koenig - Clicks below the editor canvas always focus the editor
refs https://github.com/TryGhost/Ghost/issues/9623
- fixes the broken click handling and expands it
    - trigger for clicks on the container rather than only the editor canvas
    - trigger only if the click is below the editor canvas
    - create an empty paragraph if the last section in the doc is a card
2018-05-15 17:17:51 +01:00
Kevin Ansfield be7e42e478 Koenig - Initial code card with MD expansion
refs https://github.com/TryGhost/Ghost/issues/9623
- `code` card that uses CodeMirror for the edit view and outputs `<pre><code>...</code></pre>` for the rendered view
- adds triple-backtick text expansion for creating code cards
2018-05-15 15:26:34 +01:00
Kevin Ansfield 5f92a9b886 Koenig - Remove dev experiments flag requirement in admin
refs https://github.com/TryGhost/Ghost/issues/9505
- Koenig is entering beta so we no longer want to hide the checkbox behind a developer experiments flag
2018-05-15 12:40:21 +01:00
Kevin Ansfield 106e29f67b Koenig - Strip all formatting except links when converting to a heading
refs https://github.com/TryGhost/Ghost/issues/9623
- adds `toggleHeaderSection` action to have a central place for logic
- adds `_performEdit()` so that we can avoid nested runloops in actions
- update text expansion and toolbar to use the new `toggleHeaderSection` action
2018-05-15 12:32:44 +01:00
Aileen Nowak dd3518471d Version bump to 1.22.8 2018-05-15 19:11:48 +08:00
Kevin Ansfield 7be4422975 Koenig - Allow heading levels to be changed via markdown expansion
refs https://github.com/TryGhost/Ghost/issues/9623
- disable the default mobiledoc-kit heading text expansion and replace with our own that matches heading markdown at the beginning of existing text and will change the heading level of the existing text
2018-05-14 18:29:54 +01:00
Kevin Ansfield 12a9e456fa Koenig - Expand `--` to en dash and `---` to em dash
refs https://github.com/TryGhost/Ghost/issues/9623
- match `--` and `---` and convert if followed by a space or any character respectively
- include guards to ensure that expansion doesn't occur inside code blocks
2018-05-14 17:29:49 +01:00
Kevin Ansfield f791f52267 Koenig - Fixed text deselection when toggling section formatting via toolbar
refs https://github.com/TryGhost/Ghost/issues/9623
- maintains easy reversibility by keeping text selected and toolbar shown in the same position to avoid jumping buttons when font size or other formatting changes
2018-05-14 15:53:34 +01:00
Kevin Ansfield 3caa78d355 Koenig - Fixed deletion of `/` not closing the /-menu
refs https://github.com/TryGhost/Ghost/issues/9623
2018-05-14 15:48:29 +01:00
Kevin Ansfield 17b2b1abcd Koenig - Fix triple-click select adding formatting to following paragraph
refs https://github.com/TryGhost/Ghost/issues/9623
- triple-click select will by default end the selection at position 0 of the following paragraph which means section-level formatting such as headers or quotes will affect the apparently unselected following paragraph
- add a guard to check for that selection situation and ensure the selection is constrained to the visibly selected text
2018-05-14 15:13:47 +01:00
Kevin Ansfield 41c1f631f8 Koenig - Fixed double-tap to select not immediately showing toolbar
refs https://github.com/TryGhost/Ghost/issues/9623
- keep a truthy "skip mouse move" flag around across re-triggers within the 50ms restart window to cater for slightly different mouse/selection event orders
- add a couple of guards to avoid triggering the toggle task unnecessarily
2018-05-14 14:52:40 +01:00
Kevin Ansfield da903af5c2 Bump dependencies 2018-05-14 13:56:09 +01:00
Kevin Ansfield 902e361e22 Add {{background-image-style}} helper
no issue
- cleans up multiple CPs that were only outputting a background image style
- moves URL decoding/encoding and `htmlSafe` output into one place
2018-05-14 13:04:53 +01:00
Kevin Ansfield c71437048a 🐛 Fixed low-resolution gravatar images on Team/User screens
closes https://github.com/TryGhost/Ghost/issues/9563
- fixes incorrect gravatar URLs by removing incorrect HTML encoding of the URL and enforcing URL encoding
- centralise image URL generation in the User model so that default image logic isn't spread across the app
- remove unnecessary proxy mixin from `ghost-paths` service (allows property access without `.get()`)
2018-05-14 12:15:08 +01:00
Kevin Ansfield ddced87b4a Bump ember-in-viewport dependency
no issue
- includes perf improvements for Koenig when many sticky elements can be present on a single screen
- requires bump to `ember-sticky-element`
2018-05-10 17:10:33 +01:00
Kevin Ansfield e49989bcda Koenig - Extract key commands out of `{{koenig-editor}}`
refs https://github.com/TryGhost/Ghost/issues/9505
- standardises on a single place for key command handlers
- mark re-used methods as public API rather than private
2018-05-09 18:11:22 +01:00
Zimo 03d0f1119b Koenig - Refine card menu and fix toolbar tick color
refs https://github.com/TryGhost/Ghost/issues/9505
- card menu style refinements
- fix tick color and adding appear animation to toolbar
- bump Spirit dependency
2018-05-09 16:48:13 +01:00
Kevin Ansfield 7772cfea90 Koenig - Fix error on backspace with heading as first section 2018-05-09 10:23:30 +01:00
Kevin Ansfield e2a6edb549 Version bump to 1.22.7 2018-05-09 09:21:17 +01:00
Kevin Ansfield 8d4e74bb30 🐛 Fixed tag creation via the Post Settings Menu
closes https://github.com/TryGhost/Ghost/issues/9619
- 8c23d5acef changed `availableTags` to be the direct result of `store.peekAll()` rather than a promise that resolved to the peekAll result but other code was not updated and still expected a promise object
2018-05-09 09:12:31 +01:00
Kevin Ansfield 06f183f55b Koenig - Handle deletion of last card with no other sections
refs https://github.com/TryGhost/Ghost/issues/9505
- if there is only a single card in a document and no other text then deleting it would throw an error because we assumed there's another section to move the cursor to
- handle the situation of not having a position to move to by creating a new blank paragraph and placing the cursor inside
2018-05-08 18:17:30 +01:00
Zimo 4c5151ddee Koenig - Style refinements for card menu, toolbar, and link input
refs https://github.com/TryGhost/Ghost/issues/9505
- Card menu style refinements
- Toolbar style refinements
- Unifying toolbar, link tooltip and link toolbar size and position
- Making link input the same size as text toolbar
- Fix single element position in toolbar
- Making toolbars darker
2018-05-08 18:04:56 +01:00
Kevin Ansfield 54e1ea5f47 Bump Spirit dependency 2018-05-08 17:38:20 +01:00
Kevin Ansfield cd563b66b7 Version bump to 1.22.6 2018-05-08 15:58:04 +01:00
Kevin Ansfield faf5b74517 Fixed tests
no issue
- after the ember bump the `signin` route's `deactivate` hook started throwing errors - `Property set failed: object in path "signin" could not be found or was destroyed.`
2018-05-08 12:35:42 +01:00
Kevin Ansfield 2b6e2c6bbc Bump dependencies
no issue
- bump dependencies with non-breaking changes
- no bump of yarn.lock sub-dependencies because that bumps the version of `ember-in-viewport` to 3.0.3 that does not currently work with `ember-sticky-element`
2018-05-08 10:46:24 +01:00
Peter Zimon d7b096b8f0 Koenig - Made full width images work with closed sidebar (#1014)
refs https://github.com/TryGhost/Ghost/issues/9505
- use `ui` service to adjust full-width image styles then the side nav is open
2018-05-08 10:26:46 +01:00
Kevin Ansfield 50bf7b2bc8 Bump Spirit dependencies 2018-05-08 10:23:54 +01:00
Kevin Ansfield b7b4b954ed Koenig - Fixed HTML card init error
no issue
- `payload.set` is not always a method because mobiledoc-kit can give us POJOs
2018-05-07 15:40:11 +01:00
Peter Zimon 6939fcee62 UI Fixes (#1015)
no issue
* Fixing 'Suspended' label on user screen
* Replace default avatar on users screen
* Remove shadow of 'Publish' button to work better on top of full width images
2018-05-07 12:15:44 +01:00
Kevin Ansfield ffa2622900 🐛 Fixed `invalid character` and `'define' is undefined` errors in IE11
closes https://github.com/TryGhost/Ghost/issues/9617
- bumped `ghost-spirit` to a version that doesn't use ES2015 on files that are directly included without transpilation (see related `ember-cli-cjs-transform` issue here https://github.com/rwjblue/ember-cli-cjs-transform/issues/14)
- bumped `ember-cli-ghost-spirit` to fix the `ghost-spirit` dependency version range that resulted in yarn pulling in two different versions
2018-05-04 14:51:15 +01:00
Kevin Ansfield 87bbf924a4 Remove more `import Ember` via module imports
refs https://github.com/TryGhost/Ghost/issues/8927
- removes usage of `Ember.testing`
- removes usage of `Ember.uuid`
- removes usage of `Ember.Debug.registerWarnHandler`
2018-05-03 17:52:39 +01:00
Kevin Ansfield fffa5d7125 Koenig - Remove reliance on CSS class selectors
no issue
- switch to using data attributes instead of class names to target elements to avoid problems if CSS class names change or are removed
2018-05-02 17:31:17 +01:00
Zimo 8d7f13b285 Koenig - Replace custom CSS classes with Spirit
no issue
- Koenig container styles for Spirit
- Applying Spirit styles to card menu
- Applying Spirit styles to generic cards
- Replacing icon styles with Spirit
- Fix slash menu selected state
- Cleanup of unused files + fix empty HTML
2018-05-02 15:54:22 +01:00