Comments (7)
Alternative to this would be changing how to handle images. Right now they're inserted into a p
tag, but this causes problems anyway as a p
tag's schema allows one or more inline elements inside it, which means it can insert an img
inside it and then have text either side of it.
What might be better is having embed('image')
actually insert a <figure><img/></figure>
block, then ProseMirror can select the figure
element which we can style as it's a top-level child (or rather, ask the element e.g. simpla-article
to style it). This would also fix p
being able to contain images and text.
from simpla-richtext-behavior.
You mean the blue outline when you focus on something?
outline: none;
Re: embeding, is there a reason we can't just insert a plain <img>
on its own? Why does it have to be wrapped?
from simpla-richtext-behavior.
FWIW can't repro this, whatever it is.
By selecting an image do you mean dragging over it with highlight? That's normal behavior. Way to focus an image should be to tap it.
from simpla-richtext-behavior.
Yeah dragging over it with highlight. If you tap it, it won't focus on the img because it's not an input. ProseMirror handles it by actually 'highlighting' it when you tap on it i.e. simulating dragging over it. Then the 'img' is selected. It's actually a really nice solution because the img is actually highlighted. And it's a general behavior for any future embed.
Doesn't have to wrapped I don't think - I'm just using the default ProseMirror schema which means images get inserted inline inside p
. But I can have a play with a custom schema and see how they play sitting by themselves.
from simpla-richtext-behavior.
Fixed in 3f73355, makes image top-level nodes so can be styled through ::slotted
from simpla-richtext-behavior.
FWIW tapping to focus worked for me /shrug
from simpla-richtext-behavior.
Sorry yeah so ProseMirror automatically handles taps / clicks and selects it, but the node itself isn't 'focused' as such, just highlighted / selected by ProseMirror. At least, I'm pretty sure that's how it worked
from simpla-richtext-behavior.
Related Issues (20)
- Provide hooks for embedded images HOT 2
- State history isn't working HOT 4
- Img align center shouldn't set top and bottom margin HOT 3
- Selected image should unfocus on certain hotkeys
- Images should autofocus when embedded
- Removing all the content in a formatted range should remove the format
- Should we auto focus?
- Blockquotes / Headings should be applicable in lists HOT 5
- If image embedded after first line, cannot delete first line
- Image embed shouldn't insert new line if line already exists after image
- Tapping placeholder does not focus cursor on Safari HOT 3
- Backspacing in new list item removes list, but doesn't go to new line
- Spaces clobbered in Firefox HOT 22
- Cursor should always focus to left of placeholder HOT 1
- Lists items should not create nested paragraphs HOT 5
- Generalise styles across plugins HOT 2
- Fork this into JS module HOT 5
- Make subprops notify? HOT 3
- Inserting image doesn't preserve selection HOT 3
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 simpla-richtext-behavior.