searene/Anki-Addons

Pasting from Powerpoint on Mac

Opened this issue · 3 comments

When I copy text from powerpoint and paste it into anki, the text is white with a black background, and this only happens when image resizer is installed.

screen shot 2016-01-28 at 9 31 13 am

becomes

screen shot 2016-01-28 at 9 31 17 am

Open Tools --> Preferences, check Paste clipboard images as PNG, and try again. If it doesn't work, you can send the powerpoint to my email: mycityofsky@gmail.com, and I'll check if anything goes wrong.

Sorry, I'm not sure I explained myself correctly, but in powerpoint, I'm selecting the text, and trying to paste the text ONLY into anki, not images. Image resizer works great when I'm pasting images, but when pasting text, this happens.

But it's only text from a powerpoint, if I copy it from other apps, like Word, or Notes, it doesn’t occur.

I tested the addon on Mac OS X, and I could only reproduce the problem when HTML was not stripped. I suggest that you go to Tools --> Preferences, and check Strip HTML when pasting text. The reason why the background was black and the font color was white was that you pasted CSS styles in it, too.

If you want to reserve HTML, and keep the right color, you can download my another addon PurgeAttributes. I haven't uploaded the addon on ankiweb yet, but you can still use it. Download PurgeAttributes.py, then open anki, Tools --> Add-ons --> Open Add-ons Folder, and paste PurgeAttributes.py you downloaded into the Add-ons Folder. But there's still a problem, because the font color in your powerpoint is white and the background in anki is also white too, it's impossible to see these white characters without any modification. So you should purge the font color attribute too. Open PurgeAttributes.py in your anki add-ons folder, and change the following line:

REMOVE_ATTRIBUTES = [
        'font-family',
        'font-size',
        'background-color',
        'line-height',
]

to

REMOVE_ATTRIBUTES = [
        'color',
        'background-color',
]

It might be hard if you are not a developer. I've sent you an email with the needed PurgeAttributes.py file attached. Just put it under your Anki Add-ons folder(it's usually /Users/username/Documents/Anki/addons).

And also notice, you could easily solve the problem by checking Strip HTML when pasting text without installing PurgeAttributes.

Sorry that I didn't customize the addon for Mac OS X because I didn't own one. :)