Skip to content

Commit

Permalink
Merge pull request #211 from klembot/fix-toolbar-reveal-link
Browse files Browse the repository at this point in the history
fix: fix insertRevealTextLink command
  • Loading branch information
klembot authored Sep 12, 2024
2 parents 8c6ec53 + 31e0680 commit 00f8d73
Showing 1 changed file with 52 additions and 53 deletions.
105 changes: 52 additions & 53 deletions src/twine-extensions/codemirror-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,57 +40,56 @@ function makeWrapTextCommands(
}

export const commands = {
...makeWrapTextCommands({
boldText: {
matcher: /^(?:__|\*\*)(.+)(?:__|\*\*)$/,
wrapper: (text: string) => `**${text}**`
},
italicText: {
matcher: /^(?:_|\*)(.+)(?:_|\*)$/,
wrapper: (text: string) => `*${text}*`
},
monospacedText: {
matcher: /^`(.+)`$/,
wrapper: (text: string) => '`' + text + '`'
},
smallCapsText: {
matcher: /^~~(.+)~~$/,
wrapper: (text: string) => `~~${text}~~`
}
}),
...makeInsertTextCommands({
insertAfter: '\n[after 1 second]\nText\n\n[continued]',
insertAppend: '\n[append]\n',
insertBlockquote: '\n<blockquote>Text</blockquote>\n',
insertContinue: '\n[continued]\n',
insertBulletedList: '\n- Item\n- Item\n',
insertCss: '\n[CSS]\n.page article {\n color: green;\n}\n\n[continued]\n',
insertCyclingLink:
"{cycling link for: 'variable name', choices: ['choice', 'choice']}",
insertDropdownMenu:
"{dropdown menu for: 'variable name', choices: ['choice', 'choice']}",
insertEmbedAmbientSound: "{ambient sound: 'sound name'}",
insertEmbedSoundEffect: "{sound effect: 'sound name'}",
insertEmbedPassage: "{embed passage: 'Passage name'}",
insertEmbedYouTubeVideo: "{embed YouTube video: 'URL'}",
insertImageFlickr: "{embed Flickr image: 'Flickr embed code'}",
insertImageUrl: "{embed image: 'URL to image'}",
insertImageUnsplash: '{embed Unsplash image: }',
insertForkList: '\n> Link\n> Link\n',
insertIf: '\n[if condition]\nText\n\n[continue]\n',
insertIfElse: '\n[if condition]\nText\n\n[else]Text\n\n[continued]\n',
insertJs:
"\n[JavaScript]\nwrite('Hello from JavaScript');\n\n[continued]\n",
insertNote: '\n[note]\nNote to self\n\n[continued]\n',
insertNumberedList: '\n1. Item\n2. Item\n',
insertPassageLink: "{link to: 'Passage name', label: 'Label text'}",
insertRestartLink: "{restart link, label: 'Label text'}",
insertRevealPassageLink:
"{reveal link: 'Label text', passage: 'Passage name'}",
insertRevealTextLink:
"{restart link: 'Label text', text: 'Displayed text'}",
insertSectionBreak: '\n***\n',
insertTextInput: "{text input for: 'variable name'}",
insertUnless: '\n[unless condition]\nText\n\n[continued]\n'
})
...makeWrapTextCommands({
boldText: {
matcher: /^(?:__|\*\*)(.+)(?:__|\*\*)$/,
wrapper: (text: string) => `**${text}**`
},
italicText: {
matcher: /^(?:_|\*)(.+)(?:_|\*)$/,
wrapper: (text: string) => `*${text}*`
},
monospacedText: {
matcher: /^`(.+)`$/,
wrapper: (text: string) => '`' + text + '`'
},
smallCapsText: {
matcher: /^~~(.+)~~$/,
wrapper: (text: string) => `~~${text}~~`
}
}),
...makeInsertTextCommands({
insertAfter: '\n[after 1 second]\nText\n\n[continued]',
insertAppend: '\n[append]\n',
insertBlockquote: '\n<blockquote>Text</blockquote>\n',
insertContinue: '\n[continued]\n',
insertBulletedList: '\n- Item\n- Item\n',
insertCss: '\n[CSS]\n.page article {\n color: green;\n}\n\n[continued]\n',
insertCyclingLink:
"{cycling link for: 'variable name', choices: ['choice', 'choice']}",
insertDropdownMenu:
"{dropdown menu for: 'variable name', choices: ['choice', 'choice']}",
insertEmbedAmbientSound: "{ambient sound: 'sound name'}",
insertEmbedSoundEffect: "{sound effect: 'sound name'}",
insertEmbedPassage: "{embed passage: 'Passage name'}",
insertEmbedYouTubeVideo: "{embed YouTube video: 'URL'}",
insertImageFlickr: "{embed Flickr image: 'Flickr embed code'}",
insertImageUrl: "{embed image: 'URL to image'}",
insertImageUnsplash: '{embed Unsplash image: }',
insertForkList: '\n> Link\n> Link\n',
insertIf: '\n[if condition]\nText\n\n[continue]\n',
insertIfElse: '\n[if condition]\nText\n\n[else]Text\n\n[continued]\n',
insertJs:
"\n[JavaScript]\nwrite('Hello from JavaScript');\n\n[continued]\n",
insertNote: '\n[note]\nNote to self\n\n[continued]\n',
insertNumberedList: '\n1. Item\n2. Item\n',
insertPassageLink: "{link to: 'Passage name', label: 'Label text'}",
insertRestartLink: "{restart link, label: 'Label text'}",
insertRevealPassageLink:
"{reveal link: 'Label text', passage: 'Passage name'}",
insertRevealTextLink: "{reveal link: 'Label text', text: 'Displayed text'}",
insertSectionBreak: '\n***\n',
insertTextInput: "{text input for: 'variable name'}",
insertUnless: '\n[unless condition]\nText\n\n[continued]\n'
})
};

0 comments on commit 00f8d73

Please sign in to comment.