Skip to content

Commit

Permalink
insert empty space for caret when using del at start of line
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneswilm committed Feb 3, 2013
1 parent 72ba79e commit 2a7d0dc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ <h3>Contenteditable</h3>
<li>item 2</li>
<li>item 3</li>
</ul>
<p>Hi there</p>

<hr>
<p>blabnas<img src="http://graphics8.nytimes.com/images/2012/05/23/us/20120524_ARCTIC_337-slide-CZKZ/20120524_ARCTIC_337-slide-CZKZ-articleLarge.jpg" width="300" />asdsd</p>
<p><img src="http://graphics8.nytimes.com/images/2012/05/23/us/20120524_ARCTIC_337-slide-CZKZ/20120524_ARCTIC_337-slide-CZKZ-articleLarge.jpg" width="300" /></p>
<p><delete class="del cts-1" data-cid="2" data-userid="33" data-username="Jerri Blank" data-time="1326764311895" title="Deleted by Jerri Blank - 01/16/2012 8:38pm">Brooklyn</delete><insert class="ins cts-1" data-cid="3" data-userid="33" data-username="Jerri Blank" data-time="1326764319303" title="Inserted by Jerri Blank - 01/16/2012 8:38pm">Kings Point</insert>, N.Y. &mdash; Adam Katz is happy to talk to reporters when he is promoting his business, a charter flight company based on Long Island called Talon Air.</p><p>But when the subject was his position as one of America's top earners, he <delete class="del cts-1" data-cid="23" data-userid="33" data-username="Jerri Blank" data-time="1326765043953" title="Deleted by Jerri Blank - 01/16/2012 8:50pm">hesitated</delete><insert class="ins cts-1" data-cid="24" data-userid="33" data-username="Jerri Blank" data-time="1326765049283" title="Inserted by Jerri Blank - 01/16/2012 8:50pm">balked</insert>. Seated at a desk fashioned from a jet fuel cell<insert title="Inserted by Geoffrey Jellineck - 01/16/2012 8:42pm" data-time="1326764560331" data-username="Geoffrey Jellineck" data-userid="11" data-cid="20" class="ins cts-3">, wearing a button-down shirt with the company logo,</insert> he considered the public relations benefits and found them lacking: "It's not very popular to be in the 1 percent these days, is it?"</p><p><insert class="ins cts-2" data-cid="14" data-userid="22" data-username="Chuck Noblet" data-time="1326764402035" title="Inserted by Chuck Noblet - 01/16/2012 8:40pm">A few months ago, Mr. Katz was just a successful businessman with <delete class="del cts-3" data-cid="15" data-userid="11" data-username="Geoffrey Jellineck" data-time="1326764492624" title="Deleted by Geoffrey Jellineck - 01/16/2012 8:41pm">four</delete><insert class="ins cts-3" data-cid="16" data-userid="11" data-username="Geoffrey Jellineck" data-time="1326764495239" title="Inserted by Geoffrey Jellineck - 01/16/2012 8:41pm">five</insert> children, an $8 million home, a family real estate company in Manhattan and his passion, 10-year-old Talon Air.</insert></p><p>Now, the colossal gap between the very rich and everyone else <insert title="Inserted by Geoffrey Jellineck - 01/16/2012 8:46pm" data-time="1326764809499" data-username="Geoffrey Jellineck" data-userid="11" data-cid="22" class="ins cts-3">&mdash; the 1 percent versus the 99 percent &mdash; </insert>has become a rallying point in this election season. As President Obama positions himself as a defender of the middle class, and Mitt Romney, the wealthiest of the Republican presidential candidates, decries such talk as "the bitter politics of envy," Mr. Katz has found himself on the wrong end of a new paradigm.</p><p><insert class="ins cts-1" data-cid="30" data-userid="33" data-username="Jerri Blank" data-time="1326765098946" title="Inserted by Jerri Blank - 01/16/2012 8:51pm">As a member of the 1 percent, he is part of a club whose name conjures images of Wall Street bosses who are chauffeured from manse to Manhattan and fat cats who have armies of lobbyists at the ready.</insert></p> <p>But in reality it is a far larger and more varied group, one that includes podiatrists and actuaries, executives and entrepreneurs, the self-made and the silver spoon set. They are clustered not just in New York and Los Angeles, but also in Denver and Dallas. The range of wealth in the 1 percent is vast &mdash; from households that bring in $380,000 a year, according to census data, up to billionaires like Warren E. Buffett and Bill Gates.</p><p>The top 1 percent of earners in a given year receives <a title="Related data from the Tax Policy Center." href="http://www.taxpolicycenter.org/numbers/displayatab.cfm?DocID=2972">just under a fifth</a> of the country's pretax income, <a title="A Congressional Budget Office report." href="http://www.cbo.gov/publications/collections/tax/2010/pre-tax_income_shares.pdf">about double their share</a> 30 years ago. They pay just over a fourth of all federal taxes, according to the Tax Policy Center. In 2007, they accounted for about 30 percent of philanthropic giving, according to Federal Reserve data. They received 22 percent of their income from capital gains, compared with 2 percent for everybody else.</p><p><insert class="ins cts-3" data-cid="21" data-userid="11" data-username="Geoffrey Jellineck" data-time="1326764626633" title="Inserted by Geoffrey Jellineck - 01/16/2012 8:43pm">Still, they are not necessarily the idle rich. Mr. Katz, who sometimes commutes by amphibious plane and sometimes carries luggage for Talon Air passengers, likes to say he works "26/9."</insert></p> <p>Most 1 percenters were born with socioeconomic advantages, which helps explain why the 1 percent is more likely than other Americans to have jobs, according to census data. They work longer hours, being three times more likely than the 99 percent to work more than 50 hours a week, and are more likely to be self-employed. Married 1 percenters are just as likely as other couples to have two incomes, but men are the big breadwinners, earning 75 percent of the money, compared with 64 percent of the income in other households.</p><p>Though many of the wealthy lean toward the Republican Party, in interviews, 1 percenters expressed a broad range of views on how to fix the economy. They think that President Obama is ruining it, or that Republicans in Congress have gone off the deep end. They favor a flat tax, or they believe the rich should pay a higher marginal rate. Some cheered on Occupy Wall Street, saying it was about time, while others wished the protesters would just get a job or take a bath. Still others were philosophical &mdash; perhaps because they could afford to be &mdash; viewing the <a href="http://topics.nytimes.com/top/reference/timestopics/subjects/r/recession_and_depression/index.html?inline=nyt-classifier" title="More articles about the recession." class="meta-classifier">recession</a> as something that would pass, like so many previous ups and downs.</p><p><insert class="ins cts-2" data-cid="31" data-userid="22" data-username="Chuck Noblet" data-time="1326765165952" title="Inserted by Chuck Noblet - 01/16/2012 8:52pm">Of the 1 percenters interviewed for this article, almost all &amp;mdash; conservatives and liberals alike &amp;mdash; said the wealthy could and should shoulder more of the country's financial burden, and almost all said they viewed the current system as unfair. But they may prefer facing cuts to their own benefits like &lt;a href="http://topics.nytimes.com/top/reference/timestopics/subjects/s/social_security_us/index.html?inline=nyt-classifier" title="More articles about Social Security." class="meta-classifier"&gt;Social Security&lt;/a&gt; than paying more taxes. In &lt;a title="The survey, by the Russell Sage Foundation." href="http://www.russellsage.org/blog/r-mascarenhas/wealthiest-1-percent-and-common-good"&gt;one survey&lt;/a&gt; of wealthy Chicago families, almost twice as many respondents said they would cut government spending as those who said they would cut spending and raise revenue.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</insert></p><p>Even those who said the deck was stacked in their favor did not appreciate anti-rich rhetoric.</p><p>"I don't mind paying a little bit more in taxes. I don't mind putting money to programs that help the poor," said Anthony J. Bonomo of Manhasset, N.Y., who runs a medical malpractice insurance company and is a Republican. But, he said, he did mind taking a hit for the country's woes. "If those people could camp out in that park all day, why aren't they out looking for a job? Why are they blaming others?"</p><p>To many, 99 vs. 1 was an artificial distinction that overlooked hard work and moral character. "It shouldn't be relevant," said Mr. Katz , who said he both creates job and contributes to charitable causes. "I'm not hurting anyone. I'm helping a lot of people."</p><p><strong> The Enclave</strong></p><p>The placid sliver of Long Island that F. Scott Fitzgerald immortalized in "The Great Gatsby" as West Egg and East Egg seems almost to have shrugged off the recession.</p><p>A stretch of northwest Nassau County that includes Great Neck, Manhasset and Port Washington, this area has the country's highest concentration of 1 percenters, and one of the lowest unemployment rates in the state. Houses in Port Washington are worth only 10 percent less than they were at their peak, according to the <a href="http://topics.nytimes.com/top/reference/timestopics/subjects/s/standard_poors_caseshiller_home_price_index/index.html?inline=nyt-classifier" title="More articles about the Case-Shiller Home Price Index." class="meta-classifier">Standard &amp; Poor's Case-Shiller Home Price Index</a>, a far smaller decline than in the rest of the country. Yearly sales at the Americana Manhasset, the upscale granite and glass shopping center, have already exceeded their prerecession high. Even in down times, the 1 percent has <a title="Tables 1 and 2 in a related study (PDF). " href="http://www.treasury.gov/resource-center/tax-policy/Documents/incomemobilitystudy03-08revise.pdf">staying power</a>, being far more likely than any other group to stay where they are rather than slip to lower rungs of the economic ladder.</p>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/ice.js
Original file line number Diff line number Diff line change
Expand Up @@ -903,9 +903,11 @@

// A bug in webkit moves the caret out of text nodes, so we put it back in.
if (commonAncestor.nodeType !== ice.dom.TEXT_NODE) {
//console.log(range);return true;
if (ice.dom.isBlockElement(commonAncestor)) {
if (commonAncestor.childNodes.length > initialOffset) {
var nextContainer = commonAncestor.childNodes[initialOffset];
var nextContainer = document.createTextNode('');
commonAncestor.insertBefore(nextContainer, commonAncestor.childNodes[initialOffset]);
} else {
var nextContainer = ice.dom.getNextContentNode(commonAncestor, this.element);
range.setStart(nextContainer, 0)
Expand Down Expand Up @@ -1073,8 +1075,6 @@
range.moveStart(ice.dom.CHARACTER_UNIT, -1);
range.moveStart(ice.dom.CHARACTER_UNIT, 1);



// If we are deleting into, or in, a void container then move cursor to left of container
if (this._getVoidElement(range.startContainer) && !prevBlockIsEmpty) {
range.setStart(range.startContainer, 0);
Expand Down

0 comments on commit 2a7d0dc

Please sign in to comment.