Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new feature of removing highlighted color #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions home.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
</style>
<script type="text/javascript">
function custom_function_1(span_id) {
$(span_id).contents().unwrap()
alert("Hello everybody! " + span_id);
}

Expand All @@ -23,7 +24,7 @@
</head>
<body>
<h1>Go ahead and highlight some text below!</h1>
<p contenteditable>
<p>
Bacon ipsum dolor amet leberkas andouille frankfurter jerky strip steak, pastrami turkey biltong sirloin. Tur
<br>
key turducken bacon, chuck spare ribs porchetta ham shankle landjaeger bri
Expand All @@ -40,7 +41,7 @@ <h1>Go ahead and highlight some text below!</h1>
<script type="text/javascript">
$( document ).ready(function() {
$('div,p').customHighlight({
actions: [{"custom_function_1":"Custom Function 1"}, {"custom_function_2":"Custom Function 2"}],
actions: [{"custom_function_1":"Remove Highlighter"}, {"custom_function_2":"Custom Function 2"}],
position: "left",
backgroundcolor: "on",
textcolor: "off"
Expand Down
3 changes: 2 additions & 1 deletion jquery.custom-highlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@
// Add a span around the selected text, along with a class and an ID

var span = document.createElement('SPAN');
span.textContent = " + " + selection_text + " + ";
//span.textContent = " + " + selection_text + " + ";
span.textContent = selection_text;
span.classList.add("cs-editing");
span.classList.add("tooltip");

Expand Down