linkit-media-creation's People
linkit-media-creation's Issues
returnToLinkit command doesn't seem to update the linkit modal after creating a file
After uploading / creating a new media entity via the create pop up, the pop up closes but does not update the linkit insert modal with the value of the newly create media entity. Seems like an issue in somewhere: https://github.com/zweishar/Linkit-Media-Creation/blob/master/js/commands.js
As a quick and hacky way to get this working I did the following (understanding it's probably not the correct approach):
diff --git a/js/commands.js b/js/commands.js
index f21d53b..b9eaf43 100755
--- a/js/commands.js
+++ b/js/commands.js
@@ -12,26 +12,32 @@
response,
status
) {
- var Formfields = {
- "edit-attributes-href": response.returnValue,
- "edit-attributes-data-entity-type": response.entityType,
- "edit-attributes-data-entity-uuid": response.entityUUID,
- "edit-attributes-data-entity-substitution": response.entitySubstitution,
- "edit-href-dirty-check": response.returnValue
- };
+ // var Formfields = {
+ // "edit-attributes-href": response.returnValue,
+ // "edit-attributes-data-entity-type": response.entityType,
+ // "edit-attributes-data-entity-uuid": response.entityUUID,
+ // "edit-attributes-data-entity-substitution": response.entitySubstitution,
+ // "edit-href-dirty-check": response.returnValue
+ // };
- var form = $("#" + response.inputId, opener.document);
+ // var form = $("#" + response.inputId, opener.document);
- if (form.length > 0) {
- for (var key in Formfields) {
- if (Formfields.hasOwnProperty(key)) {
- var el = $('[data-drupal-selector="' + key + '"]', form);
- el.val(Formfields[key]).change();
- if (key === "edit-attributes-href") {
- el.focus();
- }
- }
- }
+ // if (form.length > 0) {
+ // for (var key in Formfields) {
+ // if (Formfields.hasOwnProperty(key)) {
+ // var el = $('[data-drupal-selector="' + key + '"]', form);
+ // el.val(Formfields[key]).change();
+ // if (key === "edit-attributes-href") {
+ // el.focus();
+ // }
+ // }
+ // }
+ // }
+
+ var linkitInputSelector = '.linkit-media-creation-url-input [data-drupal-selector="edit-attributes-href"]';
+
+ if ($(linkitInputSelector, opener.document).length > 0) {
+ $(linkitInputSelector, opener.document).val(response.returnValue).focus();
}
window.close();
Note: this is based off a vanilla 8.7.1 site with #1 and #2 applied.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.