File field type not working – WordPress 4.4

This topic is: not resolved
Viewing 11 posts - 1 through 11 (of 11 total)
Author Posts
January 25, 2016 at 10:14 am #3712
TDE_wp
Post count: 9

File field type no longer allows selecting from media library. “Insert into post” just adds a link into the content editor.

January 25, 2016 at 10:15 pm #3714
traversal
Post count: 207

Again, sorry for the delay and thanks for the report. Will check it out soon.

February 3, 2016 at 1:19 pm #3718
traversal
Post count: 207

Hi there, this one is puzzling, since I can’t recreate this scenario at all. The correct behaviour is for the button and the other two links to be replaced by just a “select” button in this case.

This is patched via JavaScript, so my guess is that there is a JavaScript error occurring that might be preventing that code from running. Are you able to check a developer console to see if that’s the case?

February 10, 2016 at 4:26 pm #3722
TDE_wp
Post count: 9

Here is an export of the field that is causing this issue. It is the ‘background_video’ field.

https://gist.github.com/patrickgalbraith/7f11dc7fb06a597196ba

February 10, 2016 at 4:41 pm #3724
TDE_wp
Post count: 9

Looks like $.ui.mpft_image is undefined when the modal is loaded.

February 15, 2016 at 10:25 am #3725
traversal
Post count: 207

Hey there.

Is that mp_hooks.js file some kind of custom script to try to redefine that widget? MasterPress doesn’t actually have code that looks like that screenshot, so I can’t fix it. Perhaps someone on your team has customised it in some way?

Travis

  • This reply was modified 8 years, 8 months ago by traversal.
February 15, 2016 at 11:32 am #3727
TDE_wp
Post count: 9

Ok that console error was my fault sorry didn’t check it closely enough.

However the issue is still there. I tried it with a clean install of WordPress 4.4. For file fields selecting “Insert into post” just inserts it into the nearest WYSIWYG area instead of linking it to the field.

February 17, 2016 at 10:07 am #3730
traversal
Post count: 207

Hey, no problems about the console thing.

So you still get absolutely no console errors in a clean install? I can’t reproduce this problem in a clean install myself, and it really points to some other JavaScript failing that blocks the execution of the JavaScript patch which modified the standard WordPress insert media dialog.

If the console is good, it may well be something about the field setup that prevents it working, but just want to make absolutely sure it’s not theme related 🙂

April 5, 2016 at 2:47 pm #3743
TDE_wp
Post count: 9

Hi I seem to have fixed it by adding this line wp.media.editor.activeEditor = ed.id;

// closure to avoid namespace collision


(function(){
    // creates the plugin

  tinymce.create('tinymce.plugins.masterpress.media', {
		mceTout : 0,

		init : function(ed, url) {

      // Add Media buttons
			ed.addButton('mp_media', {
				title : 'Insert Media',
				onclick : function() {

					var $ed = jQuery(ed);
					var workflow = $ed.data("workflow");

					if (!workflow) {
						$ed.data("workflow", wp.media.editor.add(ed.id));
						workflow = $ed.data("workflow");
					}
					
					wp.media.editor.activeEditor = ed.id;

					workflow.open();

				}
			});

		}

 	});

  // Registers plugin
  tinymce.PluginManager.add('mp_media', tinymce.plugins.masterpress.media);

})()
April 5, 2016 at 2:47 pm #3744
TDE_wp
Post count: 9

Sorry forgot to mention this is to /js/tinymce/media/media.js

April 5, 2016 at 2:51 pm #3745
TDE_wp
Post count: 9

Sorry the above fix was for a different issue with multiple editors not working.

I tested the file field with a fresh install and it seems to be working ok I think it might be a plugin conflict but I haven’t had time to track it down.

Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.

Latest From the Blog

MasterPress 1.4.1 is now available

27th May 2024

This update addresses backwards compatibility issues that were introduced in the previous update. There were some edge cases where PHP 7 had issues and it didn’t work at all on PHP 5.6.We have now changed it so that the PHP 8 compatibility changes will now only affect PHP 8 and will be more thorough with… 

Plugin Requirements

MasterPress requires a minimum of WordPress version 4.9, MySQL 5.6, and PHP version 5.6.20.

We also recommend that PHP is configured to use a memory limit of 64MB per request (128MB may be required for sites with higher complexity).

This plug-in is not compatible with the WordPress.com hosted service.

Three AM