Skip to content
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

Added Vimeo as a target for video URLs. #437

Merged
merged 1 commit into from
Jul 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/suneditor.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/lang/da.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
videoBox: {
title: 'Indsæt Video',
file: 'Indsæt fra fil',
url: 'Indlejr video / YouTube'
url: 'Indlejr video / YouTube,Vimeo'
},
audioBox: {
title: 'Indsæt Audio',
Expand Down
2 changes: 1 addition & 1 deletion src/lang/de.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
videoBox: {
title: 'Video enfügen',
file: 'Datei auswählen',
url: 'Video-URL, YouTube'
url: 'Video-URL, YouTube/Vimeo'
},
audioBox: {
title: 'Audio enfügen',
Expand Down
2 changes: 1 addition & 1 deletion src/lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
videoBox: {
title: 'Insert Video',
file: 'Select from files',
url: 'Media embed URL, YouTube'
url: 'Media embed URL, YouTube/Vimeo'
},
audioBox: {
title: 'Insert Audio',
Expand Down
2 changes: 1 addition & 1 deletion src/lang/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
videoBox: {
title: 'Insertar Video',
file: 'Seleccionar desde los archivos',
url: '¿URL del vídeo? Youtube'
url: '¿URL del vídeo? Youtube/Vimeo'
},
audioBox: {
title: 'Insertar Audio',
Expand Down
2 changes: 1 addition & 1 deletion src/lang/fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
videoBox: {
title: 'Insérer une Vidéo',
file: 'Sélectionner le fichier',
url: 'URL d’intégration du média, YouTube'
url: 'URL d’intégration du média, YouTube/Vimeo'
},
audioBox: {
title: 'Insertar une l\'audio',
Expand Down
2 changes: 1 addition & 1 deletion src/lang/it.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
videoBox: {
title: 'Inserisci Video',
file: 'Seleziona da file',
url: 'Indirizzo video, YouTube'
url: 'Indirizzo video, YouTube/Vimeo'
},
audioBox: {
title: 'Insertar Audio',
Expand Down
2 changes: 1 addition & 1 deletion src/lang/ja.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
videoBox: {
title: '動画を挿入',
file: 'ファイルの選択',
url: 'メディア埋め込まアドレス,YouTube'
url: 'メディア埋め込みアドレス, YouTube/Vimeo'
},
audioBox: {
title: 'オーディオを挿入',
Expand Down
2 changes: 1 addition & 1 deletion src/lang/ko.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
videoBox: {
title: '동영상 삽입',
file: '파일 선택',
url: '미디어 임베드 주소, 유튜브'
url: '미디어 임베드 주소, 유튜브/뷔메오'
},
audioBox: {
title: '오디오 삽입',
Expand Down
2 changes: 1 addition & 1 deletion src/lang/pl.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
videoBox: {
title: 'Wstaw wideo',
file: 'Wybierz plik',
url: 'Adres URL video, np. YouTube'
url: 'Adres URL video, np. YouTube/Vimeo'
},
audioBox: {
title: 'Wstaw audio',
Expand Down
2 changes: 1 addition & 1 deletion src/lang/pt_br.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
videoBox: {
title: 'Inserir vídeo',
file: 'Selecionar arquivos',
url: 'URL do YouTube'
url: 'URL do YouTube/Vimeo'
},
audioBox: {
title: 'Inserir audio',
Expand Down
2 changes: 1 addition & 1 deletion src/lang/ro.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
videoBox: {
title: 'Inserează video',
file: 'Selectează',
url: 'Include URL, youtube'
url: 'Include URL, youtube/vimeo'
},
audioBox: {
title: 'Inserează Audio',
Expand Down
15 changes: 13 additions & 2 deletions src/plugins/dialog/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,11 @@ export default {
url += '?' + contextVideo._youtubeQuery;
}
}
} else if (/vimeo\.com/.test(url)) {
if (url.endsWith('/')) {
url = url.slice(0, -1);
}
url = 'https://player.vimeo.com/video/' + url.slice(url.lastIndexOf('/') + 1);
}

this.plugins.video.create_video.call(this, this.plugins.video.createIframeTag.call(this), url, contextVideo.inputX.value, contextVideo.inputY.value, contextVideo._align, null, this.context.dialog.updateModal);
Expand All @@ -524,8 +529,14 @@ export default {
if (oFrame.src !== src) {
init = true;
const isYoutube = /youtu\.?be/.test(src);
if ((isYoutube && !/^iframe$/i.test(oFrame.nodeName)) || (!isYoutube && !/^videoo$/i.test(oFrame.nodeName))) {
const newTag = isYoutube ? this.plugins.video.createIframeTag.call(this) : this.plugins.video.createVideoTag.call(this);
const isVimeo = /vimeo\.com/.test(src);
if ((isYoutube || isVimeo) && !/^iframe$/i.test(oFrame.nodeName)) {
const newTag = this.plugins.customVideo.createIframeTag.call(this);
newTag.src = src;
oFrame.parentNode.replaceChild(newTag, oFrame);
contextVideo._element = oFrame = newTag;
} else if (!isYoutube && !isVimeo && !/^videoo$/i.test(oFrame, nodeName)) {
const newTag = this.plugins.customVideo.createVideoTag.call(this);
newTag.src = src;
oFrame.parentNode.replaceChild(newTag, oFrame);
contextVideo._element = oFrame = newTag;
Expand Down