Functional Specification for SimplyHTML Enhancements

classic Classic list List threaded Threaded
26 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Functional Specification for SimplyHTML Enhancements

theworldbright
Hello everyone,

I might have told some of you individually but I plan to enhance the SimplyHTML plugin. I would appreciate any feedback for how these features should work.

Change text color with hot key

Clicking the menu item Format -> Font Color (CTRL + SHIFT + C) will open a color chooser window where a color can be picked using the mouse. Clicking OK button, which can be pressed by hitting the ENTER key, will change the color of the currently selected text to the selected color. Clicking the CANCEL button will do nothing to the currently selected text color.

Change font size with hot key

Clicking the menu item Format -> Bigger (CTRL + ‘+’) or Smaller (CTRL + ‘+’) will increase or decrease the currently selected text’s font size by a relative scale.

Insert hyper link with hot key

Clicking the menu item Insert -> Hyperlink (CTRL + SHIFT + H) will open up a dialog box with a two textfields and OK and Cancel buttons. The user can either type the URL or paste the URL using (CTRL + V) into the first textfield. The user can then optionally type what the text of the URL should be into the second textfield. Clicking OK will insert the hyperlink at the current text position.

Insert picture from clipboard with hot key (Might be tricky to implement)

The user will have an image in the clipboard. Pressing Edit -> Paste (CTRL + V) will insert an image at the current cursor position.

Regards,

Kent
Reply | Threaded
Open this post in threaded view
|

Re: Functional Specification for SimplyHTML Enhancements

Felix Natter
Administrator
"theworldbright [via Freeplane Developer]"
<[hidden email]> writes:

> Hello everyone,

hello Kent,

sorry for being late - I'll try to reply.

> I might have told some of you individually but I plan to enhance the
> SimplyHTML plugin. I would appreciate any feedback for how these features
> should work.

Maybe you want to send the user who wanted this a private message via
sourceforge, so that he/she will respond to:
  http://sourceforge.net/p/freeplane/discussion/758437/thread/ee90a70c/#4b7e/7f32/d618/e548/4187/4c0b
(http://sourceforge.net/u/robertonisola/profile/)

> Change text color with hot key
>
> Clicking the menu item Format -> Font Color (CTRL + SHIFT + C) will open a
> color chooser window where a color can be picked using the mouse. Clicking
> OK button, which can be pressed by hitting the ENTER key, will change the
> color of the currently selected text to the selected color. Clicking the
> CANCEL button will do nothing to the currently selected text color.

Ok.

> Change font size with hot key
>
> Clicking the menu item Format -> Bigger (CTRL + ‘+’) or Smaller (CTRL +
> ‘+’) will increase or decrease the currently selected text’s font size
> by a

I guess you want to say CTRL + '-'

> relative scale.

Ok.

> Insert hyper link with hot key
>
> Clicking the menu item Insert -> Hyperlink (CTRL + SHIFT + H) will open up
> a dialog box with a two textfields and OK and Cancel buttons. The user can
> either type the URL or paste the URL using (CTRL + V) into the first
> textfield. The user can then optionally type what the text of the URL
> should be into the second textfield. Clicking OK will insert the hyperlink
> at the current text position.

Ok.

> Insert picture from clipboard with hot key (Might be tricky to implement)

Yes, it is not that easy.

I tried to find a solution for HTML paste from firefox to freeplane on
linux a while ago (no reply...):
http://stackoverflow.com/questions/14800053/java-clipboard-paste-html-from-firefox-on-linux
(/simplyHtml/src/com/lightdev/app/shtm/HTMLTextSelection.java)

Furthermore, one problem is that - as you know - *.mm does not include
images, so you need to save it somewhere (with a file chooser) and
include a reference to that image in the html.
There is:
http://www.freeplane.org/wiki/index.php/Add-ons_%28install%29#Insert_Inline_Image
(maybe that is enough? at least you want to copy code from there)

> The user will have an image in the clipboard. Pressing Edit -> Paste (CTRL
> + V) will insert an image at the current cursor position.

I'll be happy to help you with SimplyHTML programming (I did a few
things on simplyhtml).

A small hint: Make sure you edit src/com/... instead of
dist/src/com/... ;-)

Cheers and Best Regards,
--
Felix Natter
Reply | Threaded
Open this post in threaded view
|

Re: Functional Specification for SimplyHTML Enhancements

theworldbright
Thanks for the reply Felix! I'm planning to pick this up again in the summer.

Yeah I have already fallen into the trap of trying to edit things under dist/. Is it possible to activate the live debugger in Eclipse with SimplyHTML?

Regards,

Kent
Reply | Threaded
Open this post in threaded view
|

Re: Functional Specification for SimplyHTML Enhancements

theworldbright
Also I would like to push a development branch that I have been working on for SimplyHTML but it doesn't seem like I have the permissions.

Regards,

Kent
Reply | Threaded
Open this post in threaded view
|

Re: Functional Specification for SimplyHTML Enhancements

Dimitry Polivaev
Administrator
I have added you to the project developers. Now you should be able to get the url where you can push
your changes from https://sourceforge.net/p/simplyhtml/code/ci/master/tree/

Regards,
Dimitry

> Also I would like to push a development branch that I have been working on for SimplyHTML but it
> doesn't seem like I have the permissions.
>
> Regards,
>
> Kent
>
> ----------------------------------------------------------------------------------------------------
> If you reply to this email, your message will be added to the discussion below:
> http://freeplane-developer.996965.n3.nabble.com/Functional-Specification-for-SimplyHTML-Enhancements-tp600p681.html
>
> To start a new topic under Freeplane Developer, email [hidden email]
> To unsubscribe from Freeplane Developer, click here
> <
> NAML
> <
http://freeplane-developer.996965.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>

Reply | Threaded
Open this post in threaded view
|

Re: Functional Specification for SimplyHTML Enhancements

Felix Natter
Administrator
In reply to this post by theworldbright
"theworldbright [via Freeplane Developer]"
<[hidden email]> writes:

hello Kent,

> Thanks for the reply Felix! I'm planning to pick this up again in the
> summer.

Great, thanks for the contribution!
Please tell me when I should test things.

> Yeah I have already fallen into the trap of trying to edit things under
> dist/. Is it possible to activate the live debugger in Eclipse with
> SimplyHTML?

It should work just like it works for freeplane:
- create a normal launcher:
  - project = <your simplyhtml project>
  - Main-Class = com.lightdev.app.shtm.App
  - optinally set LANG in Environment
- Run this in debug mode

If you can't get it to work, I can offer help via skype or here.

One thing: You are using java>>1.4 and FreeMind uses
1.4 (http://downloads.netmediaeurope.de/3413/freemind-de27b1/).
--> do we agree that the new simplyhtml will not be usable by FreeMind?
--> please update README for this.
--> please use version 0.17.0 (not 0.16.10) to so that we can sell to
    the FreeMind folks that the java>>1.4 change was really necessary.

Cheers and Best Regards,
--
Felix Natter
Reply | Threaded
Open this post in threaded view
|

Re: Functional Specification for SimplyHTML Enhancements

theworldbright
In reply to this post by Felix Natter
Hey Felix!

> I tried to find a solution for HTML paste from firefox to freeplane on
> linux a while ago (no reply...):
> http://stackoverflow.com/questions/14800053/java-clipboard-paste-html-from-firefox-on-linux
> (/simplyHtml/src/com/lightdev/app/shtm/HTMLTextSelection.java)

I have not had time to continue with SimplyHTML development but I should in a week or two. For now I placed a bounty on this question; hopefully someone can help us out as it would be an useful feature to have.

Thank you for your instructions on the debugger. I probably would have a lot of trouble without it.

Regards,

Kent Shikama
Reply | Threaded
Open this post in threaded view
|

Re: Functional Specification for SimplyHTML Enhancements

Felix Natter
Administrator
"theworldbright [via Freeplane Developer]"
<[hidden email]> writes:

> Hey Felix!

hello Kent,

>> I tried to find a solution for HTML paste from firefox to freeplane on
>> linux a while ago (no reply...):
>>
> http://stackoverflow.com/questions/14800053/java-clipboard-paste-html-from-firefox-
> on-linux
>> (/simplyHtml/src/com/lightdev/app/shtm/HTMLTextSelection.java)
>
> I have not had time to continue with SimplyHTML development but I should in
> a week or two. For now I placed a bounty on this question; hopefully
> someone can help us out as it would be an useful feature to have.

+ 10^6 ;-)

I didn't even know bounties exist [1]!

I have also received mails from other devs who also would like to see a
solution to this!

> Thank you for your instructions on the debugger. I probably would have a
> lot of trouble without it.

Great - if you have any trouble just contact me or post here.

[1] http://stackoverflow.com/help/bounty

Best Regards,
--
Felix Natter
Reply | Threaded
Open this post in threaded view
|

Changing the font size with a hot key in SimplyHTML

theworldbright
In reply to this post by theworldbright
Hey everyone!

I’m currently trying to implement the ability to change the font size with a hot key in SimplyHTML. I created a FontSizeUpAction and a FontSizeDownAction that requires an instance of the  SHTMLPanelImpl and the FontSizePicker. Now I am stuck trying to figure out how to fire the actions when the user presses the hot keys. My initial instinct was to add more key bindings in the SHTMLEditorPane’s adjustKeyBindings method; however, I do not know how to obtain the Actions which I initialized in SHTMLPanelImpl’s initActions method.

>> I tried to find a solution for HTML paste from firefox to freeplane on
>> linux a while ago (no reply...):

Also there has been an answer to your question Felix:
http://stackoverflow.com/a/30296715

Regards,

Kent
Reply | Threaded
Open this post in threaded view
|

Re: Changing the font size with a hot key in SimplyHTML

Felix Natter
Administrator
"theworldbright [via Freeplane Developer]"
<[hidden email]> writes:

> Hey everyone!

hello Kent,

it's great that you are working on improving simplyhtml!

> I’m currently trying to implement the ability to change the font size with
> a hot key in SimplyHTML. I created a FontSizeUpAction and a
> FontSizeDownAction that requires an instance of the SHTMLPanelImpl and the
> FontSizePicker. Now I am stuck trying to figure out how to fire the actions
> when the user presses the hot keys. My initial instinct was to add more key
> bindings in the SHTMLEditorPane’s adjustKeyBindings method; however, I do
> not know how to obtain the Actions which I initialized in SHTMLPanelImpl’s
> initActions method.

So the hot key should be configurable?
If not, you can of course just hard-code it in your action, like
com.lightdev.app.shtm.SHTMLEditorKitActions.SHTMLEditPasteAction does.

Otherwise, can you pass a callback to the Action-constructor in
com.lightdev.app.shtm.SHTMLPanelImpl.initActions()?
I assume this doesn't help so please elaborate where your hotkey binding
comes from.

If it comes from the preferences and we require a restart then you could
read it out in the Action-ctor (see
com.lightdev.app.shtm.SHTMLEditorPane.PasteMode.getValueFromPrefs() for
example)

In any case, I think we should modify the SHTMLAction instances (see
SHTMLEditorKitActions.java) to change their keybindings (and call
panel.updateActions()) instead of duplicating the "fire action" logic.

>>> I tried to find a solution for HTML paste from firefox to freeplane on
>>> linux a while ago (no reply...):
>
> Also there has been an answer to your question Felix:
> http://stackoverflow.com/a/30296715

Unfortunately the two answers seem to be very unqualified.  Dimitry told
me that it might be fixed in Java8, so I will check that first and then
reply. Anyway, thanks for reviving this!

Cheers and Best Regards,
--
Felix Natter
Reply | Threaded
Open this post in threaded view
|

Re: Changing the font size with a hot key in SimplyHTML

Felix Natter
Administrator
In reply to this post by theworldbright
"theworldbright [via Freeplane Developer]"
<[hidden email]> writes:

> Hey everyone!
> Also there has been an answer to your question Felix:
> http://stackoverflow.com/a/30296715

Now I tested (paste from Firefox to SimplyHTML on Linux):

- J7: always pastes plain text

- J8:
  "<b>XML User Interface</b> (XUI)"
  => garbage (HTML view because the rendered view does not paste well):
  &#65533;&#65533;&#0;b&#0;&gt;&#0;X&#0;M&#0;L&#0; &#0;U&#0;s&#0;e&#0;r&#0; &#0;I&#0;n&#0;t&#0;e&#0;r&#0;f&#0;a&#0;c&#0;e&#0;&#0;/&#0;b&#0;&gt;&#0; &#0;(&#0;&#0;i&#0;&gt;&#0;X&#0;U&#0;I&#0;&#0;/&#0;i&#0;&gt;&#0;)&#0;    

I'll try to experiment with Java8 to try to fix this.

@Kent: How are things on Mac OS X?

Cheers and Best Regards,
--
Felix Natter
Reply | Threaded
Open this post in threaded view
|

Re: Changing the font size with a hot key in SimplyHTML

theworldbright
In reply to this post by Felix Natter
Hey Felix!

Thanks for your reply. It has been fairly helpful while trying to get my head around SimplyHTML.

>> If not, you can of course just hard-code it in your action, like
>> com.lightdev.app.shtm.SHTMLEditorKitActions.SHTMLEditPasteAction does.

Yeah I was planning to do just this. However, for some reason the two actions I created just don't fire. I did all sorts of weird things and discovered that modifying these two lines of code magically fire the actions I created:

-        addAction(pasteAction, new SHTMLEditorKitActions.SHTMLEditPasteAction(this));
-        addAction(pasteOtherAction, new SHTMLEditorKitActions.SHTMLEditPasteOtherAction(this));
+        addAction(pasteAction, new SHTMLEditorKitActions.FontSizeUpAction(this));
+        addAction(pasteOtherAction, new SHTMLEditorKitActions.FontSizeDownAction(this));

In other words, as long as I associate my FontSizeUp/DownAction with any currently working action name, it works fine. Do you have an idea why this is happening (I pushed my changes)? Does it have to do with not having an equivalent JMenu?

If a JMenu item is required, I feel like it might just be better to have a nested menu structure that looks like the following:

Format
----Font
--------Show Fonts (equivalent to the Fonts... modal right now)
--------Style
------------Bold
------------Italic
------------Underline
--------Size
------------Bigger
------------Smaller
--------Font Color
--------Remove Formatting
------------------------------------- (The current separator line)
----Paragraph

etc...

Regards,

Kent
Reply | Threaded
Open this post in threaded view
|

Re: Changing the font size with a hot key in SimplyHTML

theworldbright
In reply to this post by Felix Natter
It actually almost works on Mac OS X O.o Here are the results of copying the entire "In the news" section of the Wikipedia main page (https://en.wikipedia.org/wiki/Main_Page) from Firefox to SimplyHTML on Mac OS X.

Java 7:

<html>
  <head>

  </head>
  <body>
    table id=&quot;mp-right&quot; style=&quot;width:100%; vertical-align:top; 
    background:#f5faff;&quot;&gt;
  </body>
  <tr>
    <td style="padding-left: 2px; padding-right: 2px; padding-bottom: 2px; padding-top: 2px">
      <h2 style="margin-bottom: 3px; background-image: null; font-weight: bold; margin-right: 3px; border-right-color: #a3b0bf; background-attachment: scroll; padding-right: 0; padding-bottom: 0; background-repeat: repeat; border-bottom-color: #a3b0bf; font-size: 120%; padding-left: 0; margin-left: 3px; padding-top: 0; border-left-width: 1px; border-left-style: solid; font-family: inherit; background-position: null; text-align: left; border-top-color: #a3b0bf; border-left-color: #a3b0bf; border-right-width: 1px; border-right-style: solid; border-bottom-style: solid; margin-top: 3px; border-top-width: 1px; background-color: #cedff2; border-bottom-width: 1px; color: #000; border-top-style: solid" id="mp-itn-h2">
        <span class="mw-headline" id="In_the_news">In the news</span>
      </h2>
    </td>
  </tr>
  <tr>
    <td style="padding-left: 5px; padding-right: 5px; color: #000; padding-bottom: 2px; padding-top: 2px">
      <div id="mp-itn">
        <div style="float: right; margin-left: 0" id="mp-itn-img">
          <p>
            <a href="https://en.wikipedia.org/wiki/File:2014_FIFA_Announcement_%28Joseph_Blatter%29_6.jpg" title="Sepp Blatter"><img data-file-height="1920" src="https://upload.wikimedia.org/wikipedia/en/thumb/b/b6/2014_FIFA_Announcement_%28Joseph_Blatter%29_6_cropped.jpg/75px-2014_FIFA_Announcement_%28Joseph_Blatter%29_6_cropped.jpg" width="75" srcset="//upload.wikimedia.org/wikipedia/en/thumb/b/b6/2014_FIFA_Announcement_%28Joseph_Blatter%29_6_cropped.jpg/112px-2014_FIFA_Announcement_%28Joseph_Blatter%29_6_cropped.jpg 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/b/b6/2014_FIFA_Announcement_%28Joseph_Blatter%29_6_cropped.jpg/150px-2014_FIFA_Announcement_%28Joseph_Blatter%29_6_cropped.jpg 2x" height="100" alt="Sepp Blatter" data-file-width="1440">
            </a>
          </p>
        </div>
        <ul>
          <li>
            <a href="https://en.wikipedia.org/wiki/Sepp_Blatter" title="Sepp Blatter"><b>Sepp Blatter</b></a>&#160;<i>(pictured)</i>&#160;resigns as <a href="https://en.wikipedia.org/wiki/List_of_presidents_of_FIFA" title="List of presidents of FIFA">president 
            of FIFA</a>&#160;in the wake of <a href="https://en.wikipedia.org/wiki/2015_FIFA_corruption_case" title="2015 FIFA corruption case"><b>corruption indictments of FIFA 
            officials</b></a>.
          </li>
          <li>
            At least 65 people are confirmed dead and more than 350 missing 
            after a Chinese cruise ship is <a href="https://en.wikipedia.org/wiki/Sinking_of_the_Dong_Fang_Zhi_Xing" title="Sinking of the Dong Fang Zhi Xing"><b>struck by a tornado and sinks</b></a>&#160;
            in the <a href="https://en.wikipedia.org/wiki/Yangtze" title="Yangtze">Yangtze</a>.
          </li>
          <li>
            Almost half of the world's <a href="https://en.wikipedia.org/wiki/Saiga_antelope" title="Saiga antelope"><b>saiga antelopes</b></a>, a <a href="https://en.wikipedia.org/wiki/Critically_endangered" title="Critically endangered">critically 
            endangered</a>&#160;species, die in May from suspected <a href="https://en.wikipedia.org/wiki/Pasteurellosis" title="Pasteurellosis">pasteurellosis</a>.
          </li>
          <li>
            Scientists announce the discovery of an early <a href="https://en.wikipedia.org/wiki/Hominini" title="Hominini">hominin</a>&#160;
            species, <a href="https://en.wikipedia.org/wiki/Australopithecus_deyiremeda" title="Australopithecus deyiremeda"><i><b>Australopithecus deyiremeda</b></i></a>.
          </li>
          <li>
            Cable telecommunications company <a href="https://en.wikipedia.org/wiki/Charter_Communications" title="Charter Communications"><b>Charter</b></a>&#160;agrees to buy <a href="https://en.wikipedia.org/wiki/Time_Warner_Cable" title="Time Warner Cable"><b>Time 
            Warner Cable</b></a>&#160;in a deal worth <a href="https://en.wikipedia.org/wiki/United_States_dollar" title="United States dollar">US$</a>55.1&#160;billion.
          </li>
          <li>
            <a href="https://en.wikipedia.org/wiki/2015_Indian_heat_wave" title="2015 Indian heat wave"><b>A heat wave</b></a>&#160;in India kills more than two thousand people.
          </li>
        </ul>
      </div>
    </td>
  </tr>
  <body>
    <p>
      
    </p>
  </body>
</html>

Java 8:

<html>
  <head>

  </head>
  <body>
    table id=&quot;mp-right&quot; style=&quot;width:100%; vertical-align:top; 
    background:#f5faff;&quot;&gt;
  </body>
  <tr>
    <td style="padding-top: 2px; padding-right: 2px; padding-bottom: 2px; padding-left: 2px">
      <h2 id="mp-itn-h2" style="margin-top: 3px; margin-right: 3px; margin-bottom: 3px; margin-left: 3px; background-color: #cedff2; background-image: null; background-repeat: repeat; background-attachment: scroll; background-position: null; font-family: inherit; font-size: 120%; font-weight: bold; border-top-color: #a3b0bf; border-top-style: solid; border-top-width: 1px; border-right-color: #a3b0bf; border-right-style: solid; border-right-width: 1px; border-bottom-color: #a3b0bf; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: #a3b0bf; border-left-style: solid; border-left-width: 1px; text-align: left; color: #000; padding-top: 0; padding-bottom: 0; padding-right: 0; padding-left: 0">
        <span class="mw-headline" id="In_the_news">In the news</span>
      </h2>
    </td>
  </tr>
  <tr>
    <td style="color: #000; padding-top: 2px; padding-bottom: 2px; padding-right: 5px; padding-left: 5px">
      <div id="mp-itn">
        <div id="mp-itn-img" style="float: right; margin-left: 0">
          <p>
            <a href="https://en.wikipedia.org/wiki/File:2014_FIFA_Announcement_%28Joseph_Blatter%29_6.jpg" title="Sepp Blatter"><img alt="Sepp Blatter" src="https://upload.wikimedia.org/wikipedia/en/thumb/b/b6/2014_FIFA_Announcement_%28Joseph_Blatter%29_6_cropped.jpg/75px-2014_FIFA_Announcement_%28Joseph_Blatter%29_6_cropped.jpg" srcset="//upload.wikimedia.org/wikipedia/en/thumb/b/b6/2014_FIFA_Announcement_%28Joseph_Blatter%29_6_cropped.jpg/112px-2014_FIFA_Announcement_%28Joseph_Blatter%29_6_cropped.jpg 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/b/b6/2014_FIFA_Announcement_%28Joseph_Blatter%29_6_cropped.jpg/150px-2014_FIFA_Announcement_%28Joseph_Blatter%29_6_cropped.jpg 2x" data-file-width="1440" data-file-height="1920" height="100" width="75">
            </a>
          </p>
        </div>
        <ul>
          <li>
            <b><a href="https://en.wikipedia.org/wiki/Sepp_Blatter" title="Sepp Blatter">Sepp Blatter</a></b>&#160;<i>(pictured)</i>&#160;resigns as <a href="https://en.wikipedia.org/wiki/List_of_presidents_of_FIFA" title="List of presidents of FIFA">president 
            of FIFA</a>&#160;in the wake of <b><a href="https://en.wikipedia.org/wiki/2015_FIFA_corruption_case" title="2015 FIFA corruption case">corruption indictments of FIFA 
            officials</a></b>.
          </li>
          <li>
            At least 65 people are confirmed dead and more than 350 missing 
            after a Chinese cruise ship is <b><a href="https://en.wikipedia.org/wiki/Sinking_of_the_Dong_Fang_Zhi_Xing" title="Sinking of the Dong Fang Zhi Xing">struck by a tornado and sinks</a></b>&#160;
            in the <a href="https://en.wikipedia.org/wiki/Yangtze" title="Yangtze">Yangtze</a>.
          </li>
          <li>
            Almost half of the world's <b><a href="https://en.wikipedia.org/wiki/Saiga_antelope" title="Saiga antelope">saiga antelopes</a></b>, a <a href="https://en.wikipedia.org/wiki/Critically_endangered" title="Critically endangered">critically 
            endangered</a>&#160;species, die in May from suspected <a href="https://en.wikipedia.org/wiki/Pasteurellosis" title="Pasteurellosis">pasteurellosis</a>.
          </li>
          <li>
            Scientists announce the discovery of an early <a href="https://en.wikipedia.org/wiki/Hominini" title="Hominini">hominin</a>&#160;
            species, <i><b><a href="https://en.wikipedia.org/wiki/Australopithecus_deyiremeda" title="Australopithecus deyiremeda">Australopithecus deyiremeda</a></b></i>.
          </li>
          <li>
            Cable telecommunications company <b><a href="https://en.wikipedia.org/wiki/Charter_Communications" title="Charter Communications">Charter</a></b>&#160;agrees to buy <b><a href="https://en.wikipedia.org/wiki/Time_Warner_Cable" title="Time Warner Cable">Time 
            Warner Cable</a></b>&#160;in a deal worth <a href="https://en.wikipedia.org/wiki/United_States_dollar" title="United States dollar">US$</a>55.1&#160;billion.
          </li>
          <li>
            <b><a href="https://en.wikipedia.org/wiki/2015_Indian_heat_wave" title="2015 Indian heat wave">A heat wave</a></b>&#160;in India kills more than two thousand people.
          </li>
        </ul>
      </div>
    </td>
  </tr>
  <body>
    <p>
      
    </p>
  </body>
</html>

Regards,

Kent
Reply | Threaded
Open this post in threaded view
|

Re: Changing the font size with a hot key in SimplyHTML

Felix Natter
Administrator
In reply to this post by theworldbright
"theworldbright [via Freeplane Developer]"
<[hidden email]> writes:

> Hey Felix!

hello Kent,

great to hear progress from you!

> Thanks for your reply. It has been fairly helpful while trying to get my
> head around SimplyHTML.
>
>>> If not, you can of course just hard-code it in your action, like
>>> com.lightdev.app.shtm.SHTMLEditorKitActions.SHTMLEditPasteAction does.
>
> Yeah I was planning to do just this. However, for some reason the two
> actions I created just don't fire. I did all sorts of weird things and
> discovered that modifying these two lines of code magically fire the
> actions I created:
>
> - addAction(pasteAction, new SHTMLEditorKitActions.SHTMLEditPasteAction
> (this));
> - addAction(pasteOtherAction, new
> SHTMLEditorKitActions.SHTMLEditPasteOtherAction(this));
> + addAction(pasteAction, new SHTMLEditorKitActions.FontSizeUpAction(this));
> + addAction(pasteOtherAction, new SHTMLEditorKitActions.FontSizeDownAction
> (this));
>
> In other words, as long as I associate my FontSizeUp/DownAction with any
> currently working action name, it works fine. Do you have an idea why this
> is happening (I pushed my changes)? Does it have to do with not having an
> equivalent JMenu?

You need to register your action key strings in
  simplyHtml/src/com/lightdev/app/shtm/resources/SimplyHTML_common.properties
:
edit=undo redo - cut copy paste pasteOther - findReplace - selectAll -
  editPrefs - fontSizeUp fontSizeDown

(I think '-' means separator)

Note that you will have to do this again once you integrate your new
simplyhtml (0.17) into Freeplane.

The hot key for fontSizeUp seems wrong, at least for a German keyboard:
-            putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, KeyEvent.CTRL_MASK));
+            putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_PLUS, KeyEvent.CTRL_MASK));

Also, this action is not restricted to a selection (if there is any).
Do you want to fix this?

Cheers and Best Regards,
--
Felix Natter
Reply | Threaded
Open this post in threaded view
|

Re: Changing the font size with a hot key in SimplyHTML

Felix Natter
Administrator
In reply to this post by theworldbright
"theworldbright [via Freeplane Developer]"
<[hidden email]> writes:

hi Kent,

> It actually almost works on Mac OS X O.o Here are the results of copying
> the entire "In the news" section of the Wikipedia main page
> (https://en.wikipedia.org/wiki/Main_Page) from Firefox to SimplyHTML on Mac
> OS X.

Regarding the last post: Of coures the action should go to the "Format"
menu item ;-) And please provide a translatable String (look at how it's
done for the other actions in the other properties files).

So you copied the html source, or did you post the contents of the html
tab of simplyhtml? Copying plain text (even if it's html source) also
works on linux.

Can you try to paste a simple mixture of bold/italic/normal?

Cheers and Best Regards,
--
Felix Natter
Reply | Threaded
Open this post in threaded view
|

Re: Changing the font size with a hot key in SimplyHTML

theworldbright
Hello Felix!

>> You need to register your action key strings in
>>  simplyHtml/src/com/lightdev/app/shtm/resources/SimplyHTML_common.properties

I was actually trying to get the actions working without having to register them as menus. Without submenus, the format menu will feel somewhat cluttered. What would sub-menu support involve?

>> Also, this action is not restricted to a selection (if there is any).
>> Do you want to fix this?

I believe this is wanted behavior? It only adjusts the font size of the currently selected text or if there is no selected text, it adjusts the font size at the cursor.

Regards,

Kent
Reply | Threaded
Open this post in threaded view
|

Re: Changing the font size with a hot key in SimplyHTML

theworldbright
In reply to this post by Felix Natter
>> So you copied the html source, or did you post the contents of the html
>> tab of simplyhtml? Copying plain text (even if it's html source) also
>> works on linux.

I posted the contents of the html tab of simplyhtml, since the layout view looked like a mess.

So I have this file simple.html I created as follows:

<h3>This is a title</h3>
<strong>This is some bold text</strong>
<em>This is some italic text</em>
This is some plain text

It looks like the following on Firefox:

Firefox

I copy pasted from Firefox into SimplyHTML's layout view:

Layout View

The code view then looks as follows:

Code view

The results are the same for Java 7 and Java 8

Regards,

Kent
Reply | Threaded
Open this post in threaded view
|

Re: Changing the font size with a hot key in SimplyHTML

Felix Natter
Administrator
In reply to this post by theworldbright
"theworldbright [via Freeplane Developer]"
<[hidden email]> writes:

> Hello Felix!

hi Kent,

thanks for working on simplyhtml!

>>> You need to register your action key strings in
>>>
> simplyHtml/src/com/lightdev/app/shtm/resources/SimplyHTML_common.properties
>
> I was actually trying to get the actions working without having to register
> them as menus. Without submenus, the format menu will feel somewhat
> cluttered. What would sub-menu support involve?

IMHO it's ok to have menu items for everything.

I tried this:

diff --git a/src/com/lightdev/app/shtm/DynamicResource.java b/src/com/lightdev/app/shtm/DynamicResource.java
index 6f259c9..777e1ca 100644
--- a/src/com/lightdev/app/shtm/DynamicResource.java
+++ b/src/com/lightdev/app/shtm/DynamicResource.java
@@ -174,7 +174,9 @@ class DynamicResource {
             }
             else {
                 final JMenuItem mi = createMenuItem(resources, itemKeys[i]);
-                menu.add(mi);
+                if (!itemKeys[i].startsWith("fontSize")) {
+                    menu.add(mi);
+                }
             }
         }
         menu.addMenuListener(new DynamicMenuListener());

but the Action is only registered if it's added to a JToolBar or JMenu.

>>> Also, this action is not restricted to a selection (if there is any).
>>> Do you want to fix this?
>
> I believe this is wanted behavior? It only adjusts the font size of the
> currently selected text or if there is no selected text, it adjusts the
> font size at the cursor.

I was confused by the fact that the line height changes and thus the
text around the modified selection changes, too. It's fine.

Cheers and Best Regards,
--
Felix Natter
Reply | Threaded
Open this post in threaded view
|

Re: Changing the font size with a hot key in SimplyHTML

Felix Natter
Administrator
In reply to this post by theworldbright
hi Kent,

can I help you with this? I would like to see this in Freeplane 1.4 (which is still some time away..).

Submenus would involve changing the structure and logic of
 simplyHtml/src/com/lightdev/app/shtm/resources/SimplyHTML_common.properties
and the corresponding properties file for simplyhtml in freeplane.

Best Regards,
Felix
Reply | Threaded
Open this post in threaded view
|

Re: Changing the font size with a hot key in SimplyHTML

theworldbright
Hey Felix!

I'm a bit busy currently, and it might be a while before I return to SimplyHTML development. I do have some time this weekend though, and I am determined to finish at least the first three features I have outlined. Also I am very motivated by your offer of help.

Felix Natter wrote
Submenus would involve changing the structure and logic of
 simplyHtml/src/com/lightdev/app/shtm/resources/SimplyHTML_common.properties
and the corresponding properties file for simplyhtml in freeplane.
I guess the tricky part would be the adjustment of the property files. I'll see if I can look into how the Freeplane "main" application handles submenus; hopefully it will not be too tricky to duplicate the functionality over.

Regards,

Kent
12