OO-PG0010

Plug-In: Focus Checked Items

This plug-in will focus the checked items. If items are currently focused, they will be unfocused.

Return to: OmniOutliner Plug-In Collection

Focus Checked Items
 

/*{ "type": "action", "targets": ["omnioutliner"], "author": "Otto Automator", "identifier": "com.omni-automation.oo.focus-checked-items", "version": "1.0", "description": "This plug-in will focus the checked items. If items are currently focused, they will be unfocused.", "label": "Focus Checked Items", "shortLabel": "Focus Items", "paletteLabel": "Focus Items", "image": "checkmark.square" }*/ (() => { const action = new PlugIn.Action(async function(selection, sender){ // action code // selection options: columns, document, editor, items, nodes, outline, styles try { var editor = document.editors[0] if(editor.focusedItems.length > 0){ editor.focusedItems = [] } itemsToFocus = rootItem.descendants.filter(item => { return (editor.nodeForObject(item).state === State.Checked) }) if(itemsToFocus.length > 0){ editor.focusedItems = itemsToFocus } else { throw { name: "Status Issue", message: "No items have been checked." } } } catch(err){ if(!err.causedByUserCancelling){ new Alert(err.name, err.message).show() } } }); action.validate = function(selection, sender){ // validation code // selection options: columns, document, editor, items, nodes, outline, styles return true }; return action; })();