(self, action)
Paste clipboard text to field specified by constant SOURCE_FIELD
Paste clipboard text to field specified by constant SOURCE_FIELD
Paste clipboard text to field specified by constant SOURCE_FIELD
def pasteIntoField(self, action):
    '''Paste clipboard text to field specified by constant SOURCE_FIELD '''
    mode = QClipboard.Clipboard
    note = self.note
    cb = self.mw.app.clipboard().mimeData(mode=mode)
    if cb.hasText():
        cb_text = cb.text()
    if cb_text and SOURCE_FIELD in note:
        if action == "replace":
            # replace existing contents
            note[SOURCE_FIELD] = cb_text
        elif action == "add":
            # add to existing contents
            curr = note[SOURCE_FIELD]
            new = curr + "<br>" + cb_text
            note[SOURCE_FIELD] = new
        self.web.eval("""
            if (currentField) {
              saveField("key");
            }
        """)
        self.loadNote()
def pasteIntoField ( self , action ) : mode = QClipboard . Clipboard note = self . note cb = self . mw . app . clipboard ( ) . mimeData ( mode = mode ) if cb . hasText ( ) : cb_text = cb . text ( ) if cb_text and SOURCE_FIELD in note : if action == "replace" : # replace existing contents note [ SOURCE_FIELD ] = cb_text elif action == "add" : # add to existing contents curr = note [ SOURCE_FIELD ] new = curr + "<br>" + cb_text note [ SOURCE_FIELD ] = new self . web . eval ( """
            if (currentField) {
              saveField("key");
            }
        """ ) self . loadNote ( )