Comments (12)
This is also amongst my biggest frustrations when I moved from gmail to fastmail. I find I have to cut and paste-without-formatting (cmd-option-shift-V) every day just to clean up format soup in email drafts.
from squire.
Yep, I'd be interested in adding this to Squire (and FastMail) I think. The question is does it just clear inline formatting, or also block level formatting (changing h1,p -> div etc.)?
from squire.
That's a good question. I'd expect it to clear all kinds of formatting.
from squire.
+1
clear inline formatting, or also block level formatting
Both, two options <3
from squire.
+1
from squire.
+1 :)
from squire.
+1 from us at One.com too. We're evaluating Squire for our webmail application, and need this feature.
from squire.
like tinymce:
just clear style and class attribute.
from squire.
If you just clear the attributes, that will have no impact on <i>
or <b>
tags adding inline formatting.
from squire.
I've been considering ways to do this. Removing all tags beyond a short whitelist (P, BR, DIV? Others?) in the selected range should do the trick marvelously, possibly adding clearing style tags in the range. But the functionality for removing styling that I've seen is more targeted toward removing a specific list of tags. Not sure yet how to solve it, but definitely up for trying - though my schedule is pretty packed right now. Doubt I'll be able to crack into it before June rolls around.
from squire.
My suggestion would be to remove all nodes in the selection for which isInline ( node ) && !isLeaf( node )
. You obviously need to split the start/end if the selection is midway through such tags.
That should clear inline formatting. To clear block formatting as well, I would probably use the getNextBlock fn to iterate through all blocks in the selection and dump their contents into a new defaultBlockTag node, then remove the current content and replace it with the new nodes.
from squire.
Implemented (thanks @gertsonderby!) and merged into the master branch. There is now a new removeAllFormatting method.
from squire.
Related Issues (20)
- Invalid `setKeyHandler` `key` parameter type HOT 2
- Undo/ Redo does not reset the cursor position HOT 6
- Moving the editor causes a partial breakage of functionality HOT 3
- User controlled markup vs programatically generated markup HOT 1
- Regarding inline text formatting
- The purpose of the `while` loop in the `fixCursor` function is unclear
- Lists are not created automatically on Chrome Android
- Cursor position bug after link('a' element) paste in Firefox
- Missing DOMPurify import HOT 1
- willPaste event cannot be prevented HOT 2
- Region-specific key handlers HOT 2
- Redo shortcut ("Ctrl-Shift-Z") does not work
- Can not make list for Chinese characters entered via input method on safari HOT 1
- The caret displays in a wrong position on safari HOT 1
- Wrong format after pasted some plain text at the end of formatted text
- getFontInfo returns undefined for fontFamily and fontSize when they are both set on the same selection
- Html gets reformatted on Undo
- Property 'append' does not exist on type 'Node'. HOT 1
- Applying formatting to a selection with at least one formatting set won't fire `pathChange` event HOT 4
- No API function to test for alignment 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 squire.