How to use the emmet/utils/action.captureContext function in emmet

To help you get started, we’ve selected a few emmet examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github emmetio / brackets-emmet / interactive.js View on Github external
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,
				contextNode: actionUtils.captureContext(editor, r.start)
			};

			if (r.length()) {
				var pasted = utils.escapeText(r.substring(info.content));
				out.pastedContent = editorUtils.unindent(editor, pasted);
			}

			result[i] = out;
		}, true);