mirror of
				https://github.com/advplyr/audiobookshelf.git
				synced 2025-10-27 11:18:14 +01:00 
			
		
		
		
	Merge pull request #4349 from advplyr/trix_prevent_attachments
Update rich text editor to prevent pasting in images from the browser
This commit is contained in:
		
						commit
						f44c2d9e11
					
				@ -31,7 +31,7 @@
 | 
				
			|||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
    </trix-toolbar>
 | 
					    </trix-toolbar>
 | 
				
			||||||
    <trix-editor :toolbar="toolbarId" :contenteditable="!disabledEditor" :class="['trix-content']" ref="trix" :input="computedId" :placeholder="placeholder" @trix-change="handleContentChange" @trix-initialize="handleInitialize" @trix-focus="processTrixFocus" @trix-blur="processTrixBlur" />
 | 
					    <trix-editor :toolbar="toolbarId" :contenteditable="!disabledEditor" :class="['trix-content']" ref="trix" :input="computedId" :placeholder="placeholder" @trix-change="handleContentChange" @trix-initialize="handleInitialize" @trix-focus="processTrixFocus" @trix-blur="processTrixBlur" @trix-attachment-add="handleAttachmentAdd" />
 | 
				
			||||||
    <input type="hidden" :name="inputName" :id="computedId" :value="editorContent" />
 | 
					    <input type="hidden" :name="inputName" :id="computedId" :value="editorContent" />
 | 
				
			||||||
  </div>
 | 
					  </div>
 | 
				
			||||||
</template>
 | 
					</template>
 | 
				
			||||||
@ -316,6 +316,12 @@ export default {
 | 
				
			|||||||
      if (this.$refs.trix && this.$refs.trix.blur) {
 | 
					      if (this.$refs.trix && this.$refs.trix.blur) {
 | 
				
			||||||
        this.$refs.trix.blur()
 | 
					        this.$refs.trix.blur()
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    handleAttachmentAdd(event) {
 | 
				
			||||||
 | 
					      // Prevent pasting in images from the browser
 | 
				
			||||||
 | 
					      if (!event.attachment.file) {
 | 
				
			||||||
 | 
					        event.attachment.remove()
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  mounted() {
 | 
					  mounted() {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user