Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support rich HTML while copying and pasting or adding from chrome menu. #2

Open
1nsp1r3rnzt opened this issue Jun 2, 2018 · 1 comment
Assignees
Labels
feature New feature or request
Milestone

Comments

@1nsp1r3rnzt
Copy link
Owner

1nsp1r3rnzt commented Jun 2, 2018

This idea is by brumar
Currently, images are not supported and selected text is cleaned while adding from chrome menu.

The goal is to allow user to send image along with text.

Images

If you drag and drop an image, it is base64 encoded by the medium editor and displayed as

concept

Adding images to Anki

Anki stores all images in media folder and these are sent in a separate request using ankiConnect.
The sample request is

{
    "action": "storeMediaFile",
    "version": 6,
    "params": {
        "filename": "_hello.txt",
        "data": "SGVsbG8sIHdvcmxkIQ=="
    }
}

The result is standard like any other request to ankiConnect.

{
    "result": null,
    "error": null
}

process

Before Submitting data.

  1. parse body of each field data.
    sample of 1px black base64 encode image
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=">
  1. . if imageFound, Generate a random file name based + extension based on image/gif or png or jpg.
    submit the request to ankiConnect
sendRequest
"params": {
        "filename": "image992.png",
        "data": "SGVsbG8sIHdvcmxkIQ=="
    }

If successful, replace the image source in the note with the filename
else
delete the image from note body.

@1nsp1r3rnzt 1nsp1r3rnzt added the feature New feature or request label Jun 2, 2018
@1nsp1r3rnzt 1nsp1r3rnzt self-assigned this Jun 2, 2018
@1nsp1r3rnzt 1nsp1r3rnzt added this to the Shipping Next milestone Jun 2, 2018
@Marviel
Copy link

Marviel commented Feb 10, 2019

Hey @1nsp1r3rnzt this project is awesome, thank you! I don't know if you're still planning on tackling this particular feature, but I would find it most helpful -- so much so that I may be willing to put in some effort to make it happen if my skills happen to align.

Did you manage to make any progress on this feature, and is the above still an accurate representation of the body of work you think is required to make it happen?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants