Browse Source
DOC-2301: Refactor media_url_resolver function to use a Promise for better control flow (#3112)
pull/3123/head
Arvin(Jintao) Han
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
9 additions and
7 deletions
-
modules/ROOT/partials/configuration/media_url_resolver.adoc
|
|
@ -21,13 +21,15 @@ tinymce.init({ |
|
|
|
selector: 'textarea', // change this value according to your HTML |
|
|
|
plugins: 'media', |
|
|
|
toolbar: 'media', |
|
|
|
media_url_resolver: (data, resolve/*, reject*/) => { |
|
|
|
if (data.url.indexOf('YOUR_SPECIAL_VIDEO_URL') !== -1) { |
|
|
|
const embedHtml = `<iframe src="${data.url}" width="400" height="400" ></iframe>`; |
|
|
|
resolve({ html: embedHtml }); |
|
|
|
} else { |
|
|
|
resolve({ html: '' }); |
|
|
|
} |
|
|
|
media_url_resolver: (data) => { |
|
|
|
return new Promise((resolve) => { |
|
|
|
if (data.url.indexOf('YOUR_SPECIAL_VIDEO_URL') !== -1) { |
|
|
|
const embedHtml = `<iframe src="${data.url}" width="400" height="400" ></iframe>`; |
|
|
|
resolve({ html: embedHtml }); |
|
|
|
} else { |
|
|
|
resolve({ html: '' }); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
---- |