programing

tinyMCE 크기 조정 토글 제거/사용 안 함

sourcejob 2023. 6. 8. 19:38
반응형

tinyMCE 크기 조정 토글 제거/사용 안 함

작은 MCE가 그것들을 추가하고 있습니다.move and resize handles(이미지뿐만 아니라) 내 요소들 중 일부에.

저는 그들을 모두 제거하고 싶지만 성공하지 못했습니다.

이것들은 나에게 효과가 없었습니다.

tinyMCE.init({

   object_resizing : false

});

정말 쉬워야 할 것 같습니다.

좋아요. 크기 조정 js를 절대적으로 위치한 모든 요소에 추가하는 것처럼 보입니다.누군가가 답을 얻는데 도움이 된다면요

저는 그것을 제거하려고 했지만 제가 필요한 것을 하기 위해 그것을 배치해야 합니다.

TinyMCE 버전 4에서 jQuery를 제거하고 치즈라위즈의 답변을 작동시킵니다.플러그인, 초기화 코드 또는 편집기 인스턴스화 후 바로 페이지에서 사용

// var editor = your tinyMCE editor instance (e.g. tinymce.activeEditor)

editor.on('mousedown', function(e) {

        var element = e.target,
            body = editor.dom.doc.body;

        if (editor.dom.hasClass( element, 'your-class')) {
            editor.dom.setAttrib(body,'contenteditable',false);
        } else {
            editor.dom.setAttrib(body,'contenteditable',true);
        }
});

유일한 유감스러운 점은 편집을 다시 시작하려면 사용자가 편집기를 다시 클릭해야 한다는 것입니다(화살표 키가 작동하지 않음).

편집자의 본문 태그는 속성입니다.contenteditable="true"그것이 성가신 크기 조정 요소들을 추가하는 것입니다.

해당 속성을 로 설정하면false아무것도 편집할 수 없습니다.

당신이 해야 할 일은 설정하는 것입니다.onMouseDownlistener. 사용자가 문제의 요소를 클릭하는 경우...으로 설정합니다.contenteditable="false"다른 요소가 있는 경우 다음으로 설정합니다.contenteditable="true".

이것을 시도해보세요...

(function() {  

    tinymce.create('tinymce.plugins.yourplugin', {  

        init : function(ed, url) { 

            ed.onMouseDown.add(function(ed, e) {    

                var body = ed.getBody();

                if(jQuery(e.target).hasClass('target-in-question')) {

                    jQuery(body).attr({'contenteditable': false})

                    // and whatever else you want to do when clicking on that element

                }else {
                    jQuery(body).attr({'contenteditable': true})
                }

            }); 

        },  

        createControl : function(n, cm) {  

            return null;  

        },  

    });  

    tinymce.PluginManager.add('yourplugin', tinymce.plugins.yourpluginl);  

})();

언급URL : https://stackoverflow.com/questions/13352810/tinymce-remove-disable-resizing-toggles

반응형