Невозможно обновить вышитый MongoDB существующий документ только на одну строку (с помощью Android Studio)

Я в конечном итоге решил это:

            var range = sel.getRangeAt(0);
            // inserts two spans at the beginning and end of the range, to
            // calculate the offsets
            var div = document.createElement("span");
            div.setAttribute("class", START_NODE);
            range.insertNode(div);
            range.collapse(false);
            div = document.createElement("span");
            div.setAttribute("class", END_NODE);
            range.insertNode(div);
            // gets the offsets by looking up the location of the inserted spans
            // removes them after finding the offsets (also so the starting
            // offset won't screw up the ending offset)
            comment.startOffset = p.html().indexOf('<span class="' + START_NODE + '">');
            $("." + START_NODE).remove();
            comment.endOffset = p.html().indexOf('<span class="' + END_NODE + '">');
            $("." + END_NODE).remove();
            p.html(p.html());

в основном, я добавил SPAN в начале выбора диапазона, затем свернул диапазон и добавил SPAN в конце Это. Затем я просто искал индекс первого диапазона, который я добавил, и индекс второго диапазона, который я добавил, чтобы найти смещения.

0
задан MaxG 17 January 2019 в 13:58
поделиться