Comments (4)
-
Cool, look for trailing space before and after I think is a better solution! As you said, we have problem to
Ctrl + Z
in the current implementation, I think I'll change the matching pattern to[space]*bold*[space]
and transform to bold mark, and so does italic and bold italic. -
Yes, custom block/mark tags are the thing I'll work on next because some packages are related to packages from https://github.com/Canner/slate-editor-icons , might take time to achieve it.
from canner-slate-editor.
- Support
***boldItalics***
- Apply changes when inserting space after markdown syntax
- Make
Ctrl + Z
work properly - Customize types.
All these problems above are solved in the latest version v0.2.0
, give it a try!
from canner-slate-editor.
Hi, @Slapbox thanks for your compliments.
Support for custom block/mark tags
What do you mean by custom block/mark tags, any examples?
Support for * for italics - I know first-hand this is a pain due to the edge case of handling triple asterisks for italics+bold
I've added *<text>*
for italics before, but it won't work, because you will never get the bold mark. Whenever you type **<text>*
will convert to *<italic>
, in order to make both works, I decide to use different symbols. Maybe you could think of some better solution for that?
from canner-slate-editor.
For making ***boldItalics***
work in my implementation what I did was wait until space was pressed after the italics to do conversion into richtext. I personally found this to be a more natural feeling way of doing the conversion besides the fact that is allows for triple asterisks. The downside is, it leads to more to maintain.
A pleasant side effect of this method is that using Ctrl+Z
to undo prevents the markdown pattern from immediately being reapplied and instead leaves the user with their markdown as it was written. A not so pleasant side effect is that it's possible to have orphaned markdown tags in the document, for example if someone types the following but never presses Space
, instead of being bold, the text will just have the asterisks around it.
This is a sentence and **this part is bold**
Another edge case is if someone puts punctuation or text directly after the asterisk.
`This is a sentence and this part is bold.
Regarding block/mark tags, it's an issue only when using the editor as a plugin and not standalone.
Here's an example from https://github.com/Canner/slate-md-editor/blob/master/src/match/codeBlock.js
const codePlugin = PluginEditCode({
onlyIn: node => node.type === 'code_block'
})
In my implementation the tag for code blocks is codeBlock
, as opposed to code_block
. It would be great to be able to set names for the tags for integration with existing editor implementations.
The example is actually more apt than I thought, as it's the code to do exactly that for the slate-edit-code
plugin.
from canner-slate-editor.
Related Issues (20)
- Add trialing space in the end to escape from mark's scope.
- slate-icon-header not compatible with latest slate HOT 1
- Mismatched peer dependencies HOT 1
- Import markdown source
- Is java supported in the code block?
- Could we have a way to get the raw markdown value? HOT 1
- Nextjs HOT 1
- Not sure about active state of imageContainer
- Markdown Plugin HOT 1
- How to intergrate with next.js HOT 3
- How to customise toolbar icons?
- Underline not applying text color
- Error: Invariant failed: As of Slate 0.42.0, value object are no longer schema-aware, and the `value.change()` method is no longer available. Use the `editor.change()` method on the new `Editor` controller instead. HOT 2
- how to customise plugins HOT 2
- onPaste event fired on container instead of editor
- Is this repo still active?
- how to setup image Request URL after upload if not use imgur or firebase
- Can't input Chinese on iPhone
- Is it possible de update or customize plugin
- anybody support this repo still ? 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 canner-slate-editor.