Comments (3)
Try the ctrl k (or cmd k) hotkey for inserting a link. Is that what you expect the Link to Page snippet to do? If so, i assume it can be ported over quickly.
makeLink : function() {
const isLink = /^\[(.*)\]\((.*)\)$/;
const selection = this.codeMirror.getSelection().trim();
let match;
if(match = isLink.exec(selection)){
const altText = match[1];
const url = match[2];
this.codeMirror.replaceSelection(`${altText} ${url}`);
const cursor = this.codeMirror.getCursor();
this.codeMirror.setSelection({ line: cursor.line, ch: cursor.ch - url.length }, { line: cursor.line, ch: cursor.ch });
} else {
this.codeMirror.replaceSelection(`[${selection || 'alt text'}](url)`);
const cursor = this.codeMirror.getCursor();
this.codeMirror.setSelection({ line: cursor.line, ch: cursor.ch - 4 }, { line: cursor.line, ch: cursor.ch - 1 });
}
},
```
from homebrewery.
Actually maybe it is harder. The snippets are just text things, and the little JS involved is just for generating text strings. I'm not sure that it is good to conflate "plain text insertions" with "buttons that manipulate your existing text", it would be unexpected.
I do think that it would be valuable to have the "normal" toolbar of functions that you get in most WYSIWYG editors, with "Underline", "Bold", "Italic" and "add link", etc. But I think that is separate from text insertions.
from homebrewery.
Ah .. I see we do have a hot-key for insert link (ctrl-K), and it does the desired. For the life of me I couldn't remember if there was one, and the nearest thing was the Insert Link to Page snippet.
OK, don't change the insert snippet behaviour.
from homebrewery.
Related Issues (20)
- Download speed + File size increase issue HOT 11
- [FEATURE]: Versioning via "Clone to New" HOT 3
- [FEATURE]: Brew to PDF HOT 9
- Spaces before MustacheDivs causes internal text to be incorrect
- Brew language setting should reflect into og:locale, and userpage card elements
- Unclose Code Fence syntax reveals "columnSplit" div, other elements
- Chrome Crash with Inspect Tool HOT 2
- Extra account information HOT 1
- reporting a saving error - 503 HOT 3
- themes option hidden by Properties tab HOT 3
- [FEATURE, LOCAL]: Offline save HOT 6
- Pathfinder 2nd edition (P2E) Theme HOT 3
- [FEATURE, LOCAL]: Import brew from local file HOT 4
- Brew title parsed as markdown on Error pages. e.g. images will be rendered.
- Snippets Track
- [EDITOR] Unsaved Changes on Exit
- Shrinking Image hides artist credit HOT 1
- Issue: Saving Issue HOT 1
- Linking Google Drive Images no longer works HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from homebrewery.