10-10-2015, 06:44 AM | #1 |
Junior Member
Posts: 2
Karma: 10
Join Date: Oct 2015
Device: none
|
Get cursor position or highlighted text inside plugin
Hi there,
From with a plugin, is there any way to get the current position of the cursor, or the hightlighted text (start/end position) in a HTML file? Thanks. |
10-10-2015, 12:55 PM | #2 |
Sigil Developer
Posts: 7,644
Karma: 5433388
Join Date: Nov 2009
Device: many
|
Hi,
No, there isn't. The plugin can see which file was highlighted in the book browser, but can not see where the cursor is in the file. What exactly do you need to do at that point that you can't do with a regex or a search/replace? Thanks, KevinH |
10-10-2015, 12:59 PM | #3 |
Sigil Developer
Posts: 7,644
Karma: 5433388
Join Date: Nov 2009
Device: many
|
Hi,
One way around this is to add a known id to the closest tag or wrap a piece of text in a span with a known id attribute, and then invoke the plugin on the currently selected file and have it look for that id in the plugin. That might work. KevinH |
10-11-2015, 02:34 AM | #4 |
Junior Member
Posts: 2
Karma: 10
Join Date: Oct 2015
Device: none
|
Hi Kevin,
Thanks for your reply, I appreciate it. When converting pdf's into html a lot of the semantics get lost and oftentimes one (or I at least) cannot discriminate between different semantics by means of a regex. Only by comparing the original pdf and the resulting epub can one see what the original semantics was. For example, my latest conversion was a pdf with verses. At he end of a verse their could be a little note in italic. And between verses there can be commentary in italic. Each note/commentary could contain multiple </i>xyz<i> when words need to be in normal case. So far, I have not been able to write the perfect regex to handle these situations. After the crude regex work I always find myself comparing the pdf and epub page by page and fix any differences only the eye could detect. And mostly, different solutions are needed for the different scenario's. So, I was thinking about a plugin which could remain open and showing a list of 'solutions' that could be applied after selecting text in the "Book View" or "Code View". This would very much ease the flow of manually correcting 400 pages. Regards. |
11-23-2018, 04:41 AM | #5 |
Member
Posts: 17
Karma: 10
Join Date: Jul 2017
Device: epub
|
Is there now a way to get cursor position?
Hi,
It was a long time ago. So I want to know if there now a way to get cursor position or to add some html-codes at cursor position. For example I want that the user add some info to generate Table (this part is ok) and then I generate a HTML-Table (this part is ok too). Generated Table should added at cursor position (for this part I need a way). Can somebody help me with it? or does somebody has any ideas? Thank you |
11-23-2018, 10:50 AM | #6 |
Sigil Developer
Posts: 7,644
Karma: 5433388
Join Date: Nov 2009
Device: many
|
No. And there are no plans to add that feature as you can simply use Sigil's clips feature to insert a "marker" at the current cursor position and then have your plugin look for that marker and replace it with anything you want.
|
11-23-2018, 11:55 AM | #7 | |
Grand Sorcerer
Posts: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
|
|
11-25-2018, 05:37 AM | #8 |
Member
Posts: 17
Karma: 10
Join Date: Jul 2017
Device: epub
|
Ok. Thank you I will try it :-).
|
12-11-2018, 07:00 AM | #9 |
Member
Posts: 17
Karma: 10
Join Date: Jul 2017
Device: epub
|
Hi,
I have tried with pyperclip and it works thanks again. But if I use the bundled python interpreter I got this error: ImportError: No module named 'pyperclip' Error: No module named 'pyperclip' How can I use the bundled python interpreter and my plugin with pyperclip or some other packages? Thank you |
12-11-2018, 07:56 AM | #10 |
Grand Sorcerer
Posts: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
|
|
12-16-2018, 05:40 AM | #11 |
Member
Posts: 17
Karma: 10
Join Date: Jul 2017
Device: epub
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
highlighted text | exaltedwombat | Sigil | 0 | 12-07-2012 07:28 PM |
highlighted text in kindle book | flhden | Amazon Kindle | 9 | 10-24-2010 08:21 AM |
Unhighlighting highlighted text | SaifAllah1978 | enTourage Archive | 4 | 05-09-2010 05:20 PM |
PRS-600 Exporting Highlighted Text to the PC | FaisalLoco | Sony Reader | 5 | 12-03-2009 03:44 AM |
PRS-600 HELP: How to export highlighted text to the PC? | FaisalLoco | Sony Reader | 0 | 10-21-2009 05:12 AM |