How to Make TinyMCE's modal dialogs Responsive?

前端 未结 4 1047
清酒与你
清酒与你 2021-02-13 02:48

I\'m working with TinyMCE4 on a responsive CMS using Bootstrap 3. I\'ve noticed that the dialog/modals aren\'t responsive in TinyMCE4 which is a bit of a bummer. I started writi

4条回答
  •  半阙折子戏
    2021-02-13 03:06

    TinyMCE 4 is not designer friendly (absolute positioned elements with inlined widths and heights). Frankly it's giving me flashbacks.

    Having said that, use the following at yer own risk (a.k.a. test it and make sure it meets your needs). I came up with this quickly to get an acceptable look and feel for the image, link and media dialogs in Chrome on Android. If it works in iOS or older versions of Android, or happens to not totally hose other dialogs then yay, but that wasn't my primary goal.

    Good luck. Perhaps TinyMCE 5 dialogs will have sane HTML and CSS out of the box.

    @media only screen and (max-device-width: 549px) {
    
        #mce-modal-block {
        }
    
        .mce-window {
            width: auto !important;
            top: 0 !important;
            left: 0 !important;
            right: 0 !important;
            bottom: 0 !important;
            background: none !important;
        }
    
        .mce-window-head {
            background: #fff !important;
        }
    
        .mce-window-body {
            background: #fff !important;
        }
    
        .mce-foot {
        }
    
            .mce-foot > .mce-container-body {
                padding: 10px !important;
            }
    
            .mce-foot button {
            }
    
        .mce-panel {
            max-width: 100% !important;
        }
    
        .mce-container {
            max-width: 100% !important;
            height: auto !important;
        }
    
        .mce-container-body {
            max-width: 100% !important;
            height: auto !important;
        }
    
        .mce-form {
            padding: 10px !important;
        }
    
        .mce-tabs {
            max-width: 100% !important;
        }
    
            .mce-tabs .mce-tab, .mce-tabs .mce-tab.mce-active {
            }
    
        .mce-formitem {
            margin: 10px 0 !important;
        }
    
        .mce-btn > button {
        }
    
        .mce-abs-layout-item {
            position: static !important;
            width: auto !important;
        }
    
            .mce-abs-layout-item.mce-label {
                display: block !important;
            }
    
            .mce-abs-layout-item.mce-textbox {
                -webkit-box-sizing: border-box !important;
                -moz-box-sizing: border-box !important;
                box-sizing: border-box !important;
                display: block !important;
                width: 100% !important;
            }
    
            .mce-abs-layout-item.mce-combobox {
                display: flex !important;
            }
    
                .mce-abs-layout-item.mce-combobox > .mce-textbox {
                    -ms-flex: 1 1 auto;
                    -webkit-flex: 1 1 auto;
                    flex: 1 1 auto;
                    height: 29px !important;
                }
    }
    

提交回复
热议问题