问题
Is it possible to add text highlights in fixed layout epub. I added text highlights and add notes in normalize epub by using bellow code:
[webview stringByEvaluatingJavaScriptFromString:@" var selection = "";\
var results = "";\
var idspan = "";\
"];
[webview stringByEvaluatingJavaScriptFromString:@"if (window.getSelection) {\
selection = window.getSelection();\
}\
if (selection.rangeCount > 0) {\
var range = selection.getRangeAt(0);\
var span = document.createElement(\"span\");\
span.id = \"span_\" + range.startOffset + \"_\" + range.endOffset ;\
span.setAttribute(\"class\",\"uiWebviewHighlight\");\
span.setAttribute(\"onclick\",\"clickHandler(this)\");\
span.style.backgroundColor = \"skyblue\";\
range.surroundContents(span);\
selection.removeAllRanges();\
selection.addRange(range);\
results=span.id;\
}"];
[Span_id_Array addObject: [webview stringByEvaluatingJavaScriptFromString:@"results"]];
- (void)textViewDidChange:(UITextView *)textView{
NSLog(@"textViewDidChange:");
[Selected_Notes_Array addObject:Notes_TxtView.text];
[NotesDic setValue:[Selected_Notes_Array lastObject] forKey:[Span_id_Array lastObject]];
// NSLog(@"Selected_Notes_Array:%@",NotesDic);
}
I can store and retrieve Notes and Highlights by this way in normalize epub. I am getting issues in fixed layout epub. I can select a single word. but i want to select multiple words & para. Some fixed layout epub book doesn't allow to select, i don't know why.
If anyone know about this means please help me.. Thanks in advance...
来源:https://stackoverflow.com/questions/15495447/why-ibooks-doesnt-give-text-highlights-and-add-notes-functionality-in-fixed-lay