FlohGro-dev / Craftcuts

Craftcuts - a Shortcuts eXtension for Craft

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Craftcuts

Welcome to the repository of Craftcuts my Shortcuts eXtension for Craft. Please read through the instructions, especially the installation chapter. Also make sure to check out the latest changes in the changelog which will contain the latest feature updates.

There are a lot Shortcuts available which are specifically made for the use with Craftcuts which you can see in Shortcuts Made for Craftcuts.

To create your own Shortcut to use with Craftcuts check out the Template Shortcuts.

If you want to follow me for updates or get in touch you can follow me on Twitter or choose anything else to contact on my website. Feel free to create issues in the repository for bugs you notice or features you'd like to see.

If this eXtension is valuable for and you like to thank me you can support me on

Buy Me A Coffee

Become A patreon

If you want to have a look to other things I'm working, check out my website at flohgro.com.


IMPORTANT NOTE: Due to the stopped development of the Craft API (no updates since more than a year) and my personal switch away from Craft I will not bring new features to this eXtension. I develop this stuff in my free time and also for my personal use. If you have major problems and issues I will have a look and check if I can fix them, but new features won't come to the eXtension in the future. If you want to add features by yourself - you can do that by creating a PR so I can test them. I'm happy to add and mention you as contributor if you do so.


Installation

  1. Enable Craft eXtensions.
    • Mac: At the top left of the app, click your avatar, select Preferences, click 'Advanced'. Under Craft eXtensions, click the dropdown, and select 'Enabled'.
    • Web: At the top left of the web app, click your avatar, select Craft eXtensions, toggle 'Craft eXtensions' on.
  2. Download the .craftx file from the latest release
  3. Install the extension.
    • At the bottom of the right side bar, the eXtensions logo is now visible. Click the '+' sign, select the file you downloaded from the previous step, then click open.
  4. Done - you can now use the eXtension

If you want to built the eXtension by yourself (and e.g. make some custom modifications) use the instructions given by the people at Craft:

Simply run npm install and than npm run build to generate the .craftx file which can be installed.

To learn more about Craft eXtensions visit the Craft X developer portal.

Features

Craftcuts enables Craft to run your Shortcuts from within Craft.

Theoretically this enables endless possibilities for you to export your contents from Craft documents (or just turn on your lights or start playing music from Craft).

Craftcuts uses Apples official URL scheme for Shortcuts.

After installing Craftcuts the first time (or updating it to a new version) you'll see only two buttons "Add Shortcut" and "Remove Shortcut". To add a Shortcuts click on the "Add Shortcut" button which will open the configuration window for your Shortcut. You have to provide the following inputs to configure a Shortcut:

  • Shortcut Name (required): insert the exact name of the Shortcut, otherwise it will not work and you'll get an error in the Shortcuts app.
  • Display Name (required): this will be the name of the button in the eXtension to run this Shortcut
  • Shortcut Input (recommended):
    • in theory you could run a shortcut without any input from your document (if you want to turn on lights from Craft - this is totally possible:))
    • to provide blocks from the current document as input select one or more of the available options:
      • page title - this will pass the markdown deeplink to the current page to your Shortcut
      • selected blocks - this will pass the markdown deeplink to all currently selected blocks to your Shortcut
      • open tasks - this will pass the markdown deeplink of all open tasks in the current document to your Shortcut
      • url blocks - this will pass all url blocks (the ones with the preview) in markdown format from the current document to your Shortcut
      • all blocks - this will pass the markdown deeplinks to all blocks on the current page to your Shortcut
  • Separator (required if more than one input option is selected): select a separator between the inputs passed to your Shortcut - attention: please use a string which you would never use in the text of a block like e.g. "///&&&///". Use the same separator in your shortcut to separate the inputs from each other.

When you finished your configuration click on the "Add Shortcut" button in the lower right of the window. You will see a success message and a new button will be created in your Craftcuts eXtension.

If you want to remove a shortcut just click the "Remove Shortcut" button which will open a menu with all currently activated Shortcuts. When you select one of them it will be removed from Craftcuts.

In theory thats all you need todo - when you click the newly created button Craftcuts will launch the Shortcut you provided.

After the Shortcut was successfully executed Craft will be opened again.

This gets really powerful when you make use of the values passed to the Shortcut.

Depending on your configuration the launched Shortcut will receive the markdown deeplinks to e.g. the selected blocks or all tasks in the current document as text input.

An example input to the Shortcut could look like this:

[reminder 1](craftdocs://open?blockId=E151E8DE-B3C3-44D5-802D-E18AB328A0E9&spaceId=2579f404-e3cd-4s7n-gfe1-6c342199c9g2)
[reminder 2](craftdocs://open?blockId=BF3FA431-BD47-466A-8DF7-C7A6725975AB&spaceId=2579f404-e3cd-4s7n-gfe1-6c342199c9g2)
[reminder 3](craftdocs://open?blockId=3DEDFD80-6902-4460-8062-20F1CD273B7E&spaceId=2579f404-e3cd-4s7n-gfe1-6c342199c9g2)

The input can be used to do anything you like. You can e.g. add each block to Apples Reminders app with links back to the original blocks in Craft, or export just the content to your favorite writing app.

Template Shortcuts

To help you develop your own shortcut and make use of the passed content I created two Template Shortcuts to support you develop your own SHortcut for Craftcuts.

These Template parse the provided markdown deeplinks of the blocks into the content and the deeplink.

Shorcuts Made for Craftcuts

I want to provide as many Craftcuts as possible in this repository in the table below. If you created a Shortcut which can be used with Craftcuts just reach out to me with a description and the link to the Shortcut so I can add it here.

Name Description Creator Usecase / Additional Information Download
Craftcuts Template Template Shortcut to use with Craftcuts @FlohGro Template to create your own Shortcuts to work with Craftcuts Download
Craftcuts Reminders Creates Reminders based on the provided blocks @FlohGro create reminders from provided blocks Download
Craftcuts Random 2 Daily Note Adds a Random Block of the provided blocks to your Daily Note /u/iBanks3 Download
Craftcuts Open Urls Open Urls from selected blocks in Safari /u/iBanks3 & @FlohGro Post on /r/CraftDocs Download
Craft Task Reminders Create Tasks in Reminders with dates (if provided block contains a link to a daily note) /u/iBanks3 Post on /r/CraftDocs Download
Craftcuts Import Calendar Events import configurable events into the current document @FlohGro Youtube Demo Download
Craftcuts Import Current Weather Forecast import current weather forecast into the current document @FlohGro Youtube Demo Download
Craftcuts Tasks to Tomorrow move tasks to tomorrows daily note @FlohGro You can use this shortcut to move tasks from the todays note to tomorrows note Download
Craftcuts Insert Next X Days Links insert the date links to the next X days into the current document @FlohGro Youtube Demo Download

I plan to add more features and configuration options to this eXtension in the future to pass more / different content to the triggered shortcuts. If you have ideas or use cases which are not yet supported just create a new issue in the repository or reach out to me on the platform of your choice: contactme.

Changelog

v0.4 editable shortcuts

  • new: tab layout to divide into Shortcuts and Info
  • new: version check in the Info Tab (thanks to @DharamKapila for the support and inspiration)
  • new: configured shortcuts can now be edited with the new edit button on the right of each Craftcut
  • new: configured shortcuts can be reordered in the edit menu (move up / move down buttons)
  • fixed: in some edge cases the validation of the configuration was not done properly

v0.3.2 refinements for task moving feature

  • new: added support for tasks as URL blocks
  • fixed: loosing urls in task contents (now supporting urls, date links and block links)

v0.3.1 option to delete open tasks in document

  • new: input option delete and move tasks - this will delete any open task in your current document and provide them as input to the shortcut
    • attention this is a destructive action! if you don't add those tasks to another document, they will be lost
    • you can use this to move tasks from the todays note to tomorrows note with this Shortcut

v0.3 additional inputs with block changes

  • new: input option cancel and move tasks - this will cancel any open task in your current document and provide them as input to the shortcut (you can use this to move tasks from the todays note to tomorrows note with this Shortcut)
  • new: input option done tasks - will provide all done tasks from a document to the Shortcut
  • updated: multiple input template supports done tasks input - download here

v0.2 a lot more settings and Shortcut input options

  • new: configuration menu for added Shortcuts
  • new: selecting a display name for the Shortcut is now possible
  • new: configuration options to select the inputs provided to the Shortcut:
    • page title
    • selected blocks
    • open tasks
    • url blocks
    • all blocks
  • change: URL Blocks will now be exported as markdown urls and not include a link to the original block in Craft since this makes more sense

v0.1 initial release

  • new RUN Shortcuts from Craft

About

Craftcuts - a Shortcuts eXtension for Craft

License:MIT License


Languages

Language:TypeScript 93.2%Language:JavaScript 4.1%Language:CSS 2.3%Language:HTML 0.4%