block editor - How to open Wordpress media createedit Gallery Dialog

I cannot find the answer on how to open the media gallery with the createedit gallery view.I can open the media libra

I cannot find the answer on how to open the media gallery with the create/edit gallery view. I can open the media library with multiple image selection, sure. But i actually want the gallery view / flow as seen in the block type gallery.

The gallery flow has an action "create gallery" if none has been created before or "add to gallery" otherwise, where you can select multiple images with one click and confirm. It also has an action "edit gallery" where an existing gallery can be edited, which means reordering or removing items.

I tried to read the source code starting with the gallery block, but still could not figure out the answer. Also google did not give me an answer as they are outdated.

I cannot find the answer on how to open the media gallery with the create/edit gallery view. I can open the media library with multiple image selection, sure. But i actually want the gallery view / flow as seen in the block type gallery.

The gallery flow has an action "create gallery" if none has been created before or "add to gallery" otherwise, where you can select multiple images with one click and confirm. It also has an action "edit gallery" where an existing gallery can be edited, which means reordering or removing items.

I tried to read the source code starting with the gallery block, but still could not figure out the answer. Also google did not give me an answer as they are outdated.

Share Improve this question asked Jan 30, 2020 at 10:54 patmanpatman 1111 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 0

The question is a few months old but still can help someone.

To open the media uploader to the "edit gallery" view, you just have to set the state to "gallery-edit" like this :

media_uploader = wp.media({
    frame:    "post",
    state:    "gallery-edit", // here
    multiple: true,
    editing:  true,
});

For now, I still can't figure out how to set a default selected gallery on the opening, when you want to edit a gallery already created. If someone knows how to do this. Thanks!

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742303160a4418416.html

相关推荐

  • block editor - How to open Wordpress media createedit Gallery Dialog

    I cannot find the answer on how to open the media gallery with the createedit gallery view.I can open the media libra

    19小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信