Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
updateTag: function(editor) {
var info = editorUtils.outputInfo(editor);
var selCtx = selectionContext(editor, info);
// show prompt dialog that will update each
// tag from selection
prompt.show({
label: 'Enter Abbreviation',
editor: editor.editor,
update: function(abbr) {
abbr = abbr.trim();
var tag, replaced;
var didUpdate = false;
for (var i = selCtx.length - 1, ctx; i >= 0; i--) {
ctx = selCtx[i];
tag = null;
if (abbr) {
function selectionContext(editor, info) {
info = info || editorUtils.outputInfo(editor);
var result = [];
editor.exec(function(i, sel) {
var r = range(sel);
var tag = htmlMatcher.tag(info.content, r.start);
if (!r.length() && tag) {
// no selection, use tag pair
r = utils.narrowToNonSpace(info.content, tag.range);
}
var out = {
selection: r,
tag: tag,
caret: r.start,
syntax: info.syntax,
profile: info.profile || null,
counter: i + 1,
expandAbbreviation: function(editor) {
var info = editorUtils.outputInfo(editor);
var selCtx = [];
editor.exec(function(i, sel) {
var r = range(sel);
selCtx[i] = {
selection: r,
caret: r.start,
syntax: info.syntax,
profile: info.profile || null,
counter: i + 1,
contextNode: actionUtils.captureContext(editor, r.start)
};
});
return this.wrapWithAbbreviation(editor, selCtx);
},