Use this script to copy visible text, excluding text that’s hidden in folds. The resulting text is put on the pasteboard and also returned by the script.
@Volker Yes… browse through Help > Software Development Kit > Tutorials > Create Plugins the basics of creating a plugin. The basic plugin code that you’d want is something like this:
define(function(require, exports, module) {
var Extensions = require('ft/core/extensions').Extensions,
Pasteboard = require('ft/system/pasteboard').Pasteboard;
Extensions.addCommand({
name: 'copyVisible',
description: 'Copy visible text (not hidden in folds).',
performCommand: function (editor) {
var tree = editor.tree(),
results = [];
tree.nodes().forEach(function(each) {
if (!editor.nodeIsHiddenInFold(each)) {
results.push(each.line());
}
});
Pasteboard.writeString(results.join('\n'));
}
});
});
Updated Changed Pasteboard.writeString(results.join('\\n')); to Pasteboard.writeString(results.join('\n'));.