Commit b89b25c4 authored by Andreas Gärtner's avatar Andreas Gärtner
Browse files

Updated vimeo video id compatibility with further URI formats.

parent 28984aae
...@@ -332,18 +332,18 @@ Ext.define('ARSnova.view.MarkDownEditorPanel', { ...@@ -332,18 +332,18 @@ Ext.define('ARSnova.view.MarkDownEditorPanel', {
title: Messages.EDITOR_VIMEO title: Messages.EDITOR_VIMEO
}, function (textValue, urlValue) { }, function (textValue, urlValue) {
var processObj = me.getProcessVariables(); var processObj = me.getProcessVariables();
var regExp = /^.+vimeo.com\/(.*\/)?([^#\?]*)/; var regExp = /^.*(vimeo\.com\/)((channels\/[A-z]+\/)|(groups\/[A-z]+\/videos\/))?([0-9]+)/;
var match = urlValue.match(regExp); var match = urlValue.match(regExp);
var onFailure = function () { var onFailure = function () {
Ext.toast('Incorrect URL', 2000); Ext.toast('Incorrect URL', 2000);
}; };
if (match && match[2].length == 8) { if (match && match.length > 5 && !isNaN(match[5])) {
ARSnova.app.restProxy.getVimeoThumbnailUrl(match[2], { ARSnova.app.restProxy.getVimeoThumbnailUrl(match[5], {
success: function (thumbnailUrl) { success: function (thumbnailUrl) {
var formatted = "[![" + textValue + "](" + thumbnailUrl var formatted = "[![" + textValue + "](" + thumbnailUrl
+ ")](https://player.vimeo.com/video/" + match[2] + ")"; + ")](https://player.vimeo.com/video/" + match[5] + ")";
processObj.element.setValue(processObj.preSel + formatted + processObj.postSel); processObj.element.setValue(processObj.preSel + formatted + processObj.postSel);
processObj.element.focus(); processObj.element.focus();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment