Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

275
Views
¿Cómo deshabilitar deshacer (solo desde el atajo de teclado) en TinyMCE v5?

Estoy usando el editor en línea TinyMCE v5. Quiero deshabilitar deshacer/rehacer solo para atajos de teclado , es decir, Comando+Z y Comando+Mayús+Z

A continuación se muestra mi código

 class TextBlock extends Component { handleChange = (newText) => { *** updating state with newText }; handleBeforeAddUndo = () => { **** commented below code because it restricts undo/redo even on undo button click. I dont want that.** // return false; }; handleUndo = (args) => { // nothing here }; render() { const { content } = this.props.block; return ( <Editor value={content} inline={true} tinymceScriptSrc={process.env.PUBLIC_URL + '/tinymce/js/tinymce/tinymce.min.js'} init={{ height: 500, menubar: false, block_formats: 'Heading1=h1; Heading2=h2; Heading3=h3; Paragraph=p;', plugins: ['lists link paste'], setup: function (editor) { **NOTE: below i tried 'meta+z' but it doesn't work.** editor.addShortcut('meta+g', 'custom undo', () => { console.log('you pressed cmd+z'); }); }, toolbar1: 'undo redo | formatselect | bold italic link | forecolor backcolor |', toolbar2: 'bullist numlist outdent indent| alignleft aligncenter alignright alignjustify | removeformat', }} onEditorChange={(newText) => this.handleChange(newText)} onBeforeAddUndo={this.handleBeforeAddUndo} onUndo={this.handleUndo} /> ); } }

¿Cómo puedo lograr este caso de uso? Gracias a todos por el valioso tiempo.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Con respecto a la documentación, intentaría establecer los valores de hasRedo():Boolean y hasUndo():Boolean en false . Por favor, intente decir ¿funciona en su caso?

https://www.tiny.cloud/docs/api/tinymce/tinymce.undomanager/#hasredo

 setup : function(editor) { editor.UndoManager.hasUndo(false) editor.UndoManager.hasRedo(false) };
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!