Community
    • Login

    Which data types are allowed to drop?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    7 Posts 4 Posters 1.0k Views 3 Watching
    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.
    • Mario ValleM Offline
      Mario Valle
      last edited by

      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

      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • Alan KilbornA Offline
        Alan Kilborn @Mario Valle
        last edited by

        @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
        • artie-finkelsteinA Offline
          artie-finkelstein
          last edited by

          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.

          PeterJonesP 1 Reply Last reply Reply Quote 2
          • PeterJonesP Online
            PeterJones @artie-finkelstein
            last edited by PeterJones

            @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
            • Mario ValleM Offline
              Mario Valle
              last edited by

              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!

              Mario ValleM 1 Reply Last reply Reply Quote 0
              • Mario ValleM Offline
                Mario Valle @Mario Valle
                last edited by

                @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
                • Mario ValleM Offline
                  Mario Valle
                  last edited by

                  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

                  Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                  Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                  With your input, this post could be even better 💗

                  Register Login
                  • First post
                    Last post
                  The Community of users of the Notepad++ text editor.
                  Powered by NodeBB | Contributors