• Login
Community
  • Login

Which data types are allowed to drop?

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
7 Posts 4 Posters 499 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M
    Mario Valle
    last edited by Jul 31, 2021, 5:15 AM

    Which data types are allowed to be dropped to NP++?
    Dropping a text/plain data element from my application obviously works.
    Unfortunately I cannot use this type in my application due to an interference with a GUI element I’m using (Sortable.js). Tried with text/html but it does not work (works if I drop it in Word).
    Any Idea?
    Thanks for your help!
    mario

    A 1 Reply Last reply Jul 31, 2021, 11:48 AM Reply Quote 0
    • A
      Alan Kilborn @Mario Valle
      last edited by Jul 31, 2021, 11:48 AM

      @Mario-Valle

      Can you explain a bit more about what you mean?

      My interpretation so far is that you are talking about dragging-and-dropping into Notepad++. You can do this with files (which get opened when “dropped” into Notepad++, or bits of selected text (select some text in one application, drag-and-drop onto Notepad++, and the text gets put into the current document).

      But that seems rather obvious so I think that your question probably goes deeper.

      1 Reply Last reply Reply Quote 1
      • A
        artie-finkelstein
        last edited by Jul 31, 2021, 7:23 PM

        I’m going to make two wild guesses here-

        Assumption 1) I believe you are confusing mime ‘application/octet-stream’ data types text/plain and text/html used for network/internet based applications with Windows clipboard storage formats, e.g. CF_UNICODETEXT or CF_TEXT.

        Many applications will post multiple ‘formats’ to the clipboard, e.g., Vivaldi (a web browser) exports text from this page as:

        HTML Format
        CF_UNICODETEXT
        CF_LOCALE
        CF_TEXT
        CF_OEMTEXT
        

        when text is copied to the clipboard.

        While Notepad++ exports text from a random file I had open:

        CF_UNICODETEXT
        CF_LOCALE
        CF_TEXT
        CF_OEMTEXT
        

        Assumption 2) Notepad++ is most likely only willing to import text formats that it exports, .i.e., text in it’s plain formats (e.g., no Rich Text Format).

        Based on those two assumptions, I think the motivation for your question falls in the gap between those two non-overlapping domains. (a/k/a: You can’t get there from here.) I’d add to that aphorism, it may be possible by using an intermediate program to translate data types, either a clipboard manager or a more data type versatile application, e.g., Write.

        Of course, stacked assumptions can easily lead to wrong suggestions, so I second @Alan-Kilborn’s request.

        P 1 Reply Last reply Jul 31, 2021, 8:08 PM Reply Quote 2
        • P
          PeterJones @artie-finkelstein
          last edited by PeterJones Jul 31, 2021, 8:09 PM Jul 31, 2021, 8:08 PM

          @artie-finkelstein said in Which data types are allowed to drop?:

          it may be possible by using an intermediate program to translate data types

          see for reference “PasteSpecial revisited”, where I used Perl and the Npp-automation-thru-Perl module module to allow you to grab the HTML Format or other entries from the clipboard and paste into Notepad++. (But note that certain types, like CF_BITMAP, currently cause the script to crash; I thought I had it working for binary types, but either I misremembered or something has changed.)

          1 Reply Last reply Reply Quote 1
          • M
            Mario Valle
            last edited by Aug 1, 2021, 2:21 PM

            Thanks a lot for your answers!
            A bit more explanation: When I drag a text from my application I call event.dataTransfer.setData() in the drag start handler first with type equal to a custom type for dropping inside the application, then setData("text/html", html_formatted_text) for dropping to Word, and last setData("text/plain", plain_text) for dropping text to editors like NP++.
            This setting works perfectly except in one place of my application in which the drag&drop of plain text is used to order a list (package Sortable.js). So I’m try to find alternatives that hopefully are not intercepted by the package. I will try soon with the other CF_* types (after understanding the relationship between them and the MIME types of setData).
            Thanks again for now!

            M 1 Reply Last reply Aug 1, 2021, 2:36 PM Reply Quote 0
            • M
              Mario Valle @Mario Valle
              last edited by Aug 1, 2021, 2:36 PM

              @Mario-Valle Yes, I’m not using the Windows clipboard. I’m using plain browser drag and drop support (https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API ). Maybe I try to add a copy of the plain text in the clipboard and see what happens. Stay tuned.

              1 Reply Last reply Reply Quote 0
              • M
                Mario Valle
                last edited by Aug 1, 2021, 3:19 PM

                OK, copying text to clipboard works but it is not drag and drop.
                Anyway, I have to read carefully the @artie-finkelstein part on dropping files. Also I will add a separate “copy to clipboard” functionality that till now is missing (hoping drag&drop suffices).
                See you soon!

                1 Reply Last reply Reply Quote 1
                2 out of 7
                • First post
                  2/7
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors