We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
This is a simple binding handlers for knockout js.
ko.bindingHandlers['jsDiffLib'] = { update: function (element, valueAccessor) { function getHtml(table){ var elems = []; $(table).find("tbody>tr>td").each(function (item, elem) { if(elem.className === "equal"){ elems.push("<span>" + elem.innerHTML + "</span>"); } if(elem.className === "insert"){ elems.push("<ins>" + elem.innerHTML + "</ins>"); } if(elem.className === "delete"){ elems.push("<del>" + elem.innerHTML + "</del>"); } }); elems.splice(0, 1); return elems.join("<br/>"); } var options = valueAccessor(); var base = difflib.stringAsLines("\n" + options.old()), newtxt = difflib.stringAsLines("\n" + options.new()), sm = new difflib.SequenceMatcher(base, newtxt), opcodes = sm.get_opcodes(); var currentTable = diffview.buildView({ baseTextLines: base, newTextLines: newtxt, opcodes: opcodes, baseTextName: "Base Text", newTextName: "New Text", contextSize: null, viewType: 1 }); var html = getHtml(currentTable); $(element).html(html); } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
This is a simple binding handlers for knockout js.
The text was updated successfully, but these errors were encountered: