Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' into ckeditor5/t/1214
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinmar committed Jan 6, 2019
2 parents c109551 + 0a30fef commit 917a45f
Show file tree
Hide file tree
Showing 34 changed files with 222 additions and 57 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
Changelog
=========

## [10.1.0](https://github.com/ckeditor/ckeditor5-media-embed/compare/v10.0.0...v10.1.0) (2018-12-05)

### Features

* Implemented a tip in the form that helps users discover the auto embedding. Closes [#35](https://github.com/ckeditor/ckeditor5-media-embed/issues/35). ([ebdec7e](https://github.com/ckeditor/ckeditor5-media-embed/commit/ebdec7e))
* Improved responsiveness of the media form view in narrow viewports (see [ckeditor/ckeditor5#416](https://github.com/ckeditor/ckeditor5/issues/416)). ([c753463](https://github.com/ckeditor/ckeditor5-media-embed/commit/c753463))

### Bug fixes

* Floated content and media widgets should not overlap. Closes [#53](https://github.com/ckeditor/ckeditor5-media-embed/issues/53). ([d3aa6e8](https://github.com/ckeditor/ckeditor5-media-embed/commit/d3aa6e8))
* Made the media interactive when the editor is in the read-only mode (just like links). Closes [#58](https://github.com/ckeditor/ckeditor5-media-embed/issues/58). ([09c387a](https://github.com/ckeditor/ckeditor5-media-embed/commit/09c387a))
* The `AutoMediaEmbed` should not upcast the pasted URL if a media element is disallowed at the current selection. Closes [#47](https://github.com/ckeditor/ckeditor5-media-embed/issues/47). ([47092c6](https://github.com/ckeditor/ckeditor5-media-embed/commit/47092c6))

### Other changes

* Improved SVG icons size. See [ckeditor/ckeditor5-theme-lark#206](https://github.com/ckeditor/ckeditor5-theme-lark/issues/206). ([b95fc42](https://github.com/ckeditor/ckeditor5-media-embed/commit/b95fc42))
* Moved widget spacing styles from `@ckeditor/ckeditor5-theme-lark` to the feature content styles sheet (see [ckeditor/ckeditor5-theme-lark#209](https://github.com/ckeditor/ckeditor5-theme-lark/issues/209)). ([501a567](https://github.com/ckeditor/ckeditor5-media-embed/commit/501a567))
* Updated translations. ([58614b0](https://github.com/ckeditor/ckeditor5-media-embed/commit/58614b0)) ([120912c](https://github.com/ckeditor/ckeditor5-media-embed/commit/120912c)) ([e1b4206](https://github.com/ckeditor/ckeditor5-media-embed/commit/e1b4206)) ([c376e7f](https://github.com/ckeditor/ckeditor5-media-embed/commit/c376e7f))


## [10.0.0](https://github.com/ckeditor/ckeditor5-media-embed/tree/v10.0.0) (2018-10-08)

Initial implementation of the media embed feature.
2 changes: 1 addition & 1 deletion docs/_snippets/features/media-embed.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ClassicEditor
items: [
'mediaEmbed', '|', 'heading', '|', 'bold', 'italic', '|', 'undo', 'redo'
],
viewportTopOffset: 100
viewportTopOffset: window.getViewportTopOffsetConfig()
}
} )
.then( editor => {
Expand Down
2 changes: 1 addition & 1 deletion docs/features/media-embed.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ using this code snippet:
// to discover the media.
const anchor = document.createElement( 'a' );
anchor.setAttribute( 'href', element.getAttribute( 'url ') );
anchor.setAttribute( 'href', element.getAttribute( 'url' ) );
anchor.className = 'embedly-card';
element.appendChild( anchor );
Expand Down
3 changes: 2 additions & 1 deletion lang/contexts.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"media widget": "Label for the media widget.",
"Media URL": "Label for the URL input in the Media Embed URL editing balloon.",
"Paste the URL into the content to embed faster.": "The tip displayed next to the media URL input informing about an easier way of embedding.",
"Paste the media URL in the input.": "The help text displayed under the media URL input helping users to discover the interface.",
"Tip: Paste the URL into the content to embed faster.": "The tip displayed next to the media URL input informing about an easier way of embedding.",
"The URL must not be empty.": "An error message that informs about an empty value in the URL input.",
"This media URL is not supported.": "An error message that informs about unsupported media URL.",
"Insert media": "Toolbar button tooltip for the Media Embed feature."
Expand Down
4 changes: 4 additions & 0 deletions lang/translations/cs.po
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ msgctxt "Label for the URL input in the Media Embed URL editing balloon."
msgid "Media URL"
msgstr "URL adresa"

msgctxt "The tip displayed next to the media URL input informing about an easier way of embedding."
msgid "Paste the URL into the content to embed faster."
msgstr ""

msgctxt "An error message that informs about an empty value in the URL input."
msgid "The URL must not be empty."
msgstr "URL adresa musí být vyplněna."
Expand Down
4 changes: 4 additions & 0 deletions lang/translations/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ msgctxt "Label for the URL input in the Media Embed URL editing balloon."
msgid "Media URL"
msgstr "Medien-Url"

msgctxt "The tip displayed next to the media URL input informing about an easier way of embedding."
msgid "Paste the URL into the content to embed faster."
msgstr ""

msgctxt "An error message that informs about an empty value in the URL input."
msgid "The URL must not be empty."
msgstr "Die Url darf nicht leer sein"
Expand Down
4 changes: 4 additions & 0 deletions lang/translations/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ msgctxt "Label for the URL input in the Media Embed URL editing balloon."
msgid "Media URL"
msgstr "Media URL"

msgctxt "The tip displayed next to the media URL input informing about an easier way of embedding."
msgid "Paste the URL into the content to embed faster."
msgstr "Paste the URL into the content to embed faster."

msgctxt "An error message that informs about an empty value in the URL input."
msgid "The URL must not be empty."
msgstr "The URL must not be empty."
Expand Down
4 changes: 4 additions & 0 deletions lang/translations/et.po
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ msgctxt "Label for the URL input in the Media Embed URL editing balloon."
msgid "Media URL"
msgstr "Meedia URL"

msgctxt "The tip displayed next to the media URL input informing about an easier way of embedding."
msgid "Paste the URL into the content to embed faster."
msgstr ""

msgctxt "An error message that informs about an empty value in the URL input."
msgid "The URL must not be empty."
msgstr "URL-i lahter ei tohi olla tühi."
Expand Down
4 changes: 4 additions & 0 deletions lang/translations/fa.po
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ msgctxt "Label for the URL input in the Media Embed URL editing balloon."
msgid "Media URL"
msgstr "آدرس اینترنتی رسانه"

msgctxt "The tip displayed next to the media URL input informing about an easier way of embedding."
msgid "Paste the URL into the content to embed faster."
msgstr ""

msgctxt "An error message that informs about an empty value in the URL input."
msgid "The URL must not be empty."
msgstr "آدرس اینترنتی URL نباید خالی باشد."
Expand Down
6 changes: 5 additions & 1 deletion lang/translations/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ msgctxt "Label for the URL input in the Media Embed URL editing balloon."
msgid "Media URL"
msgstr "URL média"

msgctxt "The tip displayed next to the media URL input informing about an easier way of embedding."
msgid "Paste the URL into the content to embed faster."
msgstr "Coller l'URL dans le contenu pour l'insérer plus rapidement"

msgctxt "An error message that informs about an empty value in the URL input."
msgid "The URL must not be empty."
msgstr "L'URL ne peut être vide."

msgctxt "An error message that informs about unsupported media URL."
msgid "This media URL is not supported."
msgstr "Cet URL média n'est pas supporté."
msgstr "Cette URL média n'est pas supportée."

msgctxt "Toolbar button tooltip for the Media Embed feature."
msgid "Insert media"
Expand Down
4 changes: 4 additions & 0 deletions lang/translations/gl.po
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ msgctxt "Label for the URL input in the Media Embed URL editing balloon."
msgid "Media URL"
msgstr "URL multimedia"

msgctxt "The tip displayed next to the media URL input informing about an easier way of embedding."
msgid "Paste the URL into the content to embed faster."
msgstr "Pegue o URL no contido para incorporalo máis rápido."

msgctxt "An error message that informs about an empty value in the URL input."
msgid "The URL must not be empty."
msgstr "O URL non debe estar baleiro."
Expand Down
4 changes: 4 additions & 0 deletions lang/translations/hr.po
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ msgctxt "Label for the URL input in the Media Embed URL editing balloon."
msgid "Media URL"
msgstr "URL medija"

msgctxt "The tip displayed next to the media URL input informing about an easier way of embedding."
msgid "Paste the URL into the content to embed faster."
msgstr ""

msgctxt "An error message that informs about an empty value in the URL input."
msgid "The URL must not be empty."
msgstr "URL ne smije biti prazan."
Expand Down
4 changes: 4 additions & 0 deletions lang/translations/hu.po
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ msgctxt "Label for the URL input in the Media Embed URL editing balloon."
msgid "Media URL"
msgstr "Média URL"

msgctxt "The tip displayed next to the media URL input informing about an easier way of embedding."
msgid "Paste the URL into the content to embed faster."
msgstr "A gyorsabb beágyazás érdekében illessze be az URL-t."

msgctxt "An error message that informs about an empty value in the URL input."
msgid "The URL must not be empty."
msgstr "Az URL nem lehet üres."
Expand Down
4 changes: 4 additions & 0 deletions lang/translations/it.po
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ msgctxt "Label for the URL input in the Media Embed URL editing balloon."
msgid "Media URL"
msgstr "URL media"

msgctxt "The tip displayed next to the media URL input informing about an easier way of embedding."
msgid "Paste the URL into the content to embed faster."
msgstr ""

msgctxt "An error message that informs about an empty value in the URL input."
msgid "The URL must not be empty."
msgstr "L'URL non può essere vuoto."
Expand Down
4 changes: 4 additions & 0 deletions lang/translations/ne.po
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ msgctxt "Label for the URL input in the Media Embed URL editing balloon."
msgid "Media URL"
msgstr "मिडिया यूआरएल"

msgctxt "The tip displayed next to the media URL input informing about an easier way of embedding."
msgid "Paste the URL into the content to embed faster."
msgstr ""

msgctxt "An error message that informs about an empty value in the URL input."
msgid "The URL must not be empty."
msgstr "यूआरएल खाली हुनु हुँदैन।"
Expand Down
4 changes: 4 additions & 0 deletions lang/translations/no.po
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ msgctxt "Label for the URL input in the Media Embed URL editing balloon."
msgid "Media URL"
msgstr "Media-URL"

msgctxt "The tip displayed next to the media URL input informing about an easier way of embedding."
msgid "Paste the URL into the content to embed faster."
msgstr "Lim inn URL-en direkte i innholdet for å legge inn media raskere."

msgctxt "An error message that informs about an empty value in the URL input."
msgid "The URL must not be empty."
msgstr "URL-en kan ikke være tom."
Expand Down
4 changes: 4 additions & 0 deletions lang/translations/pl.po
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ msgctxt "Label for the URL input in the Media Embed URL editing balloon."
msgid "Media URL"
msgstr "Adres URL"

msgctxt "The tip displayed next to the media URL input informing about an easier way of embedding."
msgid "Paste the URL into the content to embed faster."
msgstr "Wklej URL wprost do treści edytora by wstawić go szybciej."

msgctxt "An error message that informs about an empty value in the URL input."
msgid "The URL must not be empty."
msgstr "Adres URL nie może być pusty."
Expand Down
4 changes: 4 additions & 0 deletions lang/translations/pt-br.po
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ msgctxt "Label for the URL input in the Media Embed URL editing balloon."
msgid "Media URL"
msgstr "URL da mídia"

msgctxt "The tip displayed next to the media URL input informing about an easier way of embedding."
msgid "Paste the URL into the content to embed faster."
msgstr ""

msgctxt "An error message that informs about an empty value in the URL input."
msgid "The URL must not be empty."
msgstr "A URL não pode ficar em branco."
Expand Down
4 changes: 4 additions & 0 deletions lang/translations/sq.po
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ msgctxt "Label for the URL input in the Media Embed URL editing balloon."
msgid "Media URL"
msgstr "URL e Medies"

msgctxt "The tip displayed next to the media URL input informing about an easier way of embedding."
msgid "Paste the URL into the content to embed faster."
msgstr ""

msgctxt "An error message that informs about an empty value in the URL input."
msgid "The URL must not be empty."
msgstr "URL nuk duhet të jetë e zbrazët."
Expand Down
4 changes: 4 additions & 0 deletions lang/translations/tr.po
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ msgctxt "Label for the URL input in the Media Embed URL editing balloon."
msgid "Media URL"
msgstr "Medya URL'si"

msgctxt "The tip displayed next to the media URL input informing about an easier way of embedding."
msgid "Paste the URL into the content to embed faster."
msgstr "Daha hızlı gömülü görünüm için URL'yi içeriğe yapıştırınız."

msgctxt "An error message that informs about an empty value in the URL input."
msgid "The URL must not be empty."
msgstr "URL boş olamaz."
Expand Down
4 changes: 4 additions & 0 deletions lang/translations/uk.po
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ msgctxt "Label for the URL input in the Media Embed URL editing balloon."
msgid "Media URL"
msgstr "Медіа URL"

msgctxt "The tip displayed next to the media URL input informing about an easier way of embedding."
msgid "Paste the URL into the content to embed faster."
msgstr ""

msgctxt "An error message that informs about an empty value in the URL input."
msgid "The URL must not be empty."
msgstr "URL не повинен бути порожнім."
Expand Down
4 changes: 4 additions & 0 deletions lang/translations/zh-cn.po
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ msgctxt "Label for the URL input in the Media Embed URL editing balloon."
msgid "Media URL"
msgstr "媒体URL"

msgctxt "The tip displayed next to the media URL input informing about an easier way of embedding."
msgid "Paste the URL into the content to embed faster."
msgstr ""

msgctxt "An error message that informs about an empty value in the URL input."
msgid "The URL must not be empty."
msgstr "URL不可以为空。"
Expand Down
38 changes: 19 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ckeditor/ckeditor5-media-embed",
"version": "10.0.0",
"version": "10.1.0",
"description": "Media Embed feature for CKEditor 5.",
"keywords": [
"ckeditor",
Expand All @@ -10,27 +10,27 @@
"ckeditor5-plugin"
],
"dependencies": {
"@ckeditor/ckeditor5-clipboard": "^10.0.3",
"@ckeditor/ckeditor5-core": "^11.0.1",
"@ckeditor/ckeditor5-engine": "^11.0.0",
"@ckeditor/ckeditor5-enter": "^10.1.2",
"@ckeditor/ckeditor5-image": "^11.0.0",
"@ckeditor/ckeditor5-theme-lark": "^11.1.0",
"@ckeditor/ckeditor5-ui": "^11.1.0",
"@ckeditor/ckeditor5-undo": "^10.0.3",
"@ckeditor/ckeditor5-utils": "^11.0.0",
"@ckeditor/ckeditor5-widget": "^10.3.0"
"@ckeditor/ckeditor5-clipboard": "^10.0.4",
"@ckeditor/ckeditor5-core": "^11.1.0",
"@ckeditor/ckeditor5-engine": "^12.0.0",
"@ckeditor/ckeditor5-enter": "^10.1.3",
"@ckeditor/ckeditor5-image": "^12.0.0",
"@ckeditor/ckeditor5-theme-lark": "^12.0.0",
"@ckeditor/ckeditor5-ui": "^11.2.0",
"@ckeditor/ckeditor5-undo": "^10.0.4",
"@ckeditor/ckeditor5-utils": "^11.1.0",
"@ckeditor/ckeditor5-widget": "^10.3.1"
},
"devDependencies": {
"@ckeditor/ckeditor5-basic-styles": "^10.0.3",
"@ckeditor/ckeditor5-editor-balloon": "^11.0.1",
"@ckeditor/ckeditor5-editor-classic": "^11.0.1",
"@ckeditor/ckeditor5-link": "^10.0.4",
"@ckeditor/ckeditor5-list": "^11.0.2",
"@ckeditor/ckeditor5-paragraph": "^10.0.3",
"@ckeditor/ckeditor5-typing": "^11.0.1",
"@ckeditor/ckeditor5-basic-styles": "^10.1.0",
"@ckeditor/ckeditor5-editor-balloon": "^11.0.2",
"@ckeditor/ckeditor5-editor-classic": "^11.0.2",
"@ckeditor/ckeditor5-link": "^10.1.0",
"@ckeditor/ckeditor5-list": "^11.0.3",
"@ckeditor/ckeditor5-paragraph": "^10.0.4",
"@ckeditor/ckeditor5-typing": "^11.0.2",
"eslint": "^5.5.0",
"eslint-config-ckeditor5": "^1.0.7",
"eslint-config-ckeditor5": "^1.0.9",
"husky": "^0.14.3",
"lint-staged": "^7.0.0"
},
Expand Down
8 changes: 6 additions & 2 deletions src/automediaembed.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import LiveRange from '@ckeditor/ckeditor5-engine/src/model/liverange';
import LivePosition from '@ckeditor/ckeditor5-engine/src/model/liveposition';
import Undo from '@ckeditor/ckeditor5-undo/src/undo';
import global from '@ckeditor/ckeditor5-utils/src/dom/global';
import { insertMedia } from './utils';

const URL_REGEXP = /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=]+$/;

Expand Down Expand Up @@ -153,12 +154,15 @@ export default class AutoMediaEmbed extends Plugin {

writer.remove( urlRange );

let insertionPosition;

// Check if position where the media element should be inserted is still valid.
// Otherwise leave it as undefined to use document.selection - default behavior of model.insertContent().
if ( this._positionToInsert.root.rootName !== '$graveyard' ) {
writer.setSelection( this._positionToInsert );
insertionPosition = this._positionToInsert;
}

mediaEmbedCommand.execute( url );
insertMedia( editor.model, url, insertionPosition );

this._positionToInsert.detach();
this._positionToInsert = null;
Expand Down
10 changes: 2 additions & 8 deletions src/mediaembedcommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import Command from '@ckeditor/ckeditor5-core/src/command';
import { findOptimalInsertionPosition } from '@ckeditor/ckeditor5-widget/src/utils';
import { getSelectedMediaElement } from './utils';
import { getSelectedMediaElement, insertMedia } from './utils';

/**
* The insert media command.
Expand Down Expand Up @@ -64,13 +64,7 @@ export default class MediaEmbedCommand extends Command {
} else {
const insertPosition = findOptimalInsertionPosition( selection, model );

model.change( writer => {
const mediaElement = writer.createElement( 'media', { url } );

model.insertContent( mediaElement, insertPosition );

writer.setSelection( mediaElement, 'on' );
} );
insertMedia( model, url, insertPosition );
}
}
}
Expand Down
Loading

0 comments on commit 917a45f

Please sign in to comment.