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

oembed bug when used on the options-page #542

Closed
jmarceli opened this issue Dec 10, 2015 · 6 comments
Closed

oembed bug when used on the options-page #542

jmarceli opened this issue Dec 10, 2015 · 6 comments
Labels

Comments

@jmarceli
Copy link

Oembed field doesn't display preview image when it is used to create options-page (even after saving). Is there any workaround for that, or this is unknown bug?

@jtsternberg
Copy link
Member

It's working for me. Demo

@jmarceli
Copy link
Author

Is it trunk branch? Mine doesn't work so nice.
Please check also if it works after initial save. I get this bug when I change existing oEmbed video.

@jtsternberg
Copy link
Member

You're right, it does not work after saving. We'll need to look into this.

@jmarceli
Copy link
Author

I've done it already :)
Here is my workaround (it's just workaround I don't know why it works, but it does) jmarceli@acf4559

It's fine but doesn't display preview after pasting URL (with Ajax) only after saving. The Ajax call (probably) doesn't hit the correct CMB2 method.

@satwinderrathore
Copy link

Thanks @jmarceli ,

It's worked for me,

@ghost
Copy link

ghost commented Aug 16, 2016

Hello CMB2 users and dev! new user here.

I have encountered a problem that seem to be related, maybe not worth opening a new bug for now so I will comment here.

I am evaluating CMB2 as a form solution to be used outside of the dashboard and support a post / edit worflow.

I have assigned a default value while calling add_group_fieldand then object is not instanciated completely (I dont see the visual, but it's get updated after a cut and paste).

    $cmb->add_group_field( $group_field_oembed,  array(
        'name' => 'Lien externe',
        'desc' => 'Enter a youtube, twitter, or instagram URL. Supports services listed at <a href="http://codex.wordpress.org/Embeds">http://codex.wordpress.org/Embeds</a>.',
        'id'   => 'wiki_test_embed',
        'type' => 'oembed',
        'default' => '*** some url from youtube ***'
    ) );

As a temporary workaround, I have patched init with something like this:

                var oEmbedList = $('.cmb2-oembed');
                oEmbedList.each(function(index) {
                    cmb.doAjax($( this ));
                });

And then commented out this code (assume that the object is in focus (true when updating after a url paste, but not in this case), I guess there could be a extra parameter to differentiate the use case.

                /*
                    if ( $( '.cmb2-oembed:focus' ).val() !== oembed_url ) {
            return;
        }
                */

The visual refresh (cm.maybeOembed in javascript file) seem to be binded on focusout, keyup and paste only.
My first question would surely be : is it a intended behavior?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants