nclud / verbatim Goto Github PK
View Code? Open in Web Editor NEWA jQuery plugin that enables deep linking to your content. Currently in beta.
Home Page: http://verbat.im
A jQuery plugin that enables deep linking to your content. Currently in beta.
Home Page: http://verbat.im
If selecting across multiple elements only the first element seems to receive the highlight class.
It may be possible to implement a loop for the output of the getSelected function (https://github.com/nclud/verbatim/blob/master/src/verbatim.js#L123) when adding a class for each anchorNode (like here: https://github.com/nclud/verbatim/blob/master/src/verbatim.js#L95).
@aberkie & I have noticed this behavior on some sites like this: http://www.thirdway.org/report/the-untapped-political-power-of-asian-americans#mmentators%20on%20the%20Right%2C%20many.
This seems to have to do with the interplay of the spellcheck
attribute that can affect either contentEditable or designMode settings, but I can't pin it down.
Would document.spellcheck = false;
do the trick?
The position of the buton container does not behave consistently because it gets appended to the target selected element, which might have position: relative (or a combination of absolute and relative with parent elements), limiting and messing with the button position.
Appending the button container to document.body does not cause these problems because the body represents the whole document therefore absolute values represent the correct position. Then we can safely use event.pageX and event.pageY to position the container absolutely in the dom.
function appendButton(){
var target;
var $doc = $(document.body);
$($doc).append(buttonContainer);
$('span[style*="'+settings.highlightColor+'"]').addClass(settings.selectedClass);
if ((upY - downY) > 15)
target = 0
else
target = ($(anchorNode).outerWidth() / 2) - $('.' + settings.buttonClass).width() / 2;
$('.' + settings.buttonClass).css({
"left": event.pageX - 50,
"top": event.pageY - 50
})
}
this line
$('.' + settings.selectedClass).contents().unwrap();
does remove the parent of the selected text, upon deselection the parent is not reinstated causing html/css issues . I have just disabled it, the plugin seems to work just fine, what's the purpose of it?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.