Skip to content Skip to sidebar Skip to footer

Python/javascript: Wysiwyg Html Editor - Handle Large Documents Fast And/or Design Theory

Background: I am writing an ebook editing program in python. Currently it utilizes a source-code view for editing, and I would like to port it over to a wysiwyg view for editing. T

Solution 1:

Can i suggest a complete another approach ? Since your ebook is only <p></p>:

  • Split the text on <p></p> to get an indexed array of all your paragraphs
  • Make your own pagination system, and fill the screen with N paragraphs, that automatically get enough text to show from the indexed array
  • When you are doing selection, you can use [paragraph index + character index in the paragraph] for selection start / end
  • Then implement cut/copy/paste/delete/undo/redo based on thoses assumptions.

(Note: when you'll do a selection, since the start point is saved, you can safely change the text on the screen / pagination, until the selection end.)

Post a Comment for "Python/javascript: Wysiwyg Html Editor - Handle Large Documents Fast And/or Design Theory"