Comments (2)
wow, true, thank you for reporting it!
any idea how to fix it?
from ngwig.
I added some custom buttons with custom functions (I call these function also if you pres the Tab/Shift Tab)
` function indentInNgWig() {
const selection = window.getSelection();
const ngWig = findAncestor(selection.focusNode, '.ng-wig');
const rtl = isRTL(ngWig);
if (!hasLiParent(selection, ngWig) && rtl) {
document.execCommand('formatBlock', false, 'p');
changeMargin(ngWig, true);
} else {
document.execCommand('indent', false);
}
}
function outdentInNgWig() {
const selection = window.getSelection();
const ngWig = findAncestor(selection.focusNode, '.ng-wig');
const rtl = isRTL(ngWig);
if (!hasLiParent(selection, ngWig) && rtl) {
changeMargin(ngWig, false);
} else {
document.execCommand('outdent', false);
}
}
function changeMargin(ngWigEditor, indent: boolean) {
const selectedElement = window.getSelection().focusNode.parentNode as HTMLElement;
const declaration = selectedElement.style;
let margin = declaration.marginRight;
const currentValue = (margin !== '') ? parseInt(margin.replace('px', ''), 10) : 0;
if (indent) {
margin = currentValue + indentation + 'px';
declaration.marginRight = margin;
}
if (!indent && currentValue >= indentation) {
if (currentValue === indentation) {
while (selectedElement.childNodes.length > 0) {
selectedElement.parentNode.insertBefore(selectedElement.childNodes[0], selectedElement);
}
selectedElement.remove();
} else if (currentValue > indentation) {
margin = (currentValue - indentation) + 'px';
declaration.marginRight = margin;
}
}
}
function isRTL(ngWigEditor) {
const computedStyle = getComputedStyle(ngWigEditor) as any;
if (computedStyle.direction === 'rtl') {
return true;
}
return false;
}`
from ngwig.
Related Issues (20)
- Not working with angular 1.6.1 HOT 2
- Initial ng-model not displayed if placeholder is used HOT 2
- Placeholder not showing up HOT 4
- Editor examples HOT 3
- NPM packages install fails HOT 2
- OnPaste Hook not working correctly when selecting all content on IE HOT 6
- Strange behavior ngWig because of css styles
- Insert Image? HOT 2
- Security Issue HOT 7
- custom button - append content HOT 3
- How to focus on the container ? HOT 4
- Release 3.0.16 missing HOT 3
- go to next ngWig with tab key HOT 7
- formats not working in IE HOT 2
- Different plugins per instance HOT 1
- Error: Cannot find module 'internal/util/types' HOT 2
- Release 3.0.18 missing HOT 3
- Issue with multiple instances HOT 2
- Unable to push or create PR targeting to upstream HOT 6
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 ngwig.