Results 1 to 8 of 8

Thread: designmode cursor position

  1. #1
    Join Date
    Feb 2007

    designmode cursor position


    Is anyone here familiar with browser iframe / designmode operations?

    I have a designmode page that ideally should support preset fontstyles. So depending on the selected preset, the initial iframe contents with no text yet could, for example, be:

    <font color="#000"><font face="Verdana">&nbsp;</font></Font>
    But depending on the browser, when you click in the iframe and start typing, the above style is not necessarily applied. What I am trying to figure out is how you can automatically set the cursor so it is positioned between the Font tags at &nbsp; so the style is actually applied to the entered text.

    Anyone knows how to do that?


  2. #2
    Join Date
    Feb 2007
    Just to add, I meant how to set the cursor to this position when the iframe gets focus:

    document.addEventListener ("focus", function (e) {
    }, true);

  3. #3
    Join Date
    Mar 2012
    The <font> tag is not supported in HTML5, and your syntax is wrong anyway. Use CSS styling instead. What has it got to do with IFrames, or getting focus?

  4. #4
    No clue what "designmode" means, though it reeks of WYSIWYG nonsense which is automatically rubbish markup and how not to build a website -- something that those ugly FONT tags that have no business on any website written after 1997 more than proves.

    Not sure what you're trying to do, but it sounds bad... Really bad... as in pitch it in the trash, learn some HTML and forget whatever it is you are trying to do bad. Sorry if that sounds harsh, but the truth most always is. That one little code snippet filled with FONT tags alone screams it loud and clear as yes, it's THAT bad.

  5. #5
    Join Date
    Mar 2012
    Thinking about it, I guess that you are writing your own CMS, or something like that? Perhaps a greetings card creator that others can use? If so, I'd respectfully suggest that you need to be proficient in HML and CSS. If that snippet of code is representative of your current level of expertise, you may have a long way to go!

    I'd also suggest leaving JavaScript alone for the time being. Why? Because, if you do not know HTML and CSS thoroughly, it's easy to fall into bad habits of using JS and frameworks unnecessarily to do things that are better done in HTML and/or CSS.

  6. #6
    Join Date
    Feb 2007
    Yes jedaisoul, this is some sort of a CMS system. I guess I did not explain myself very well.

    This is a system that will allow the user to create contents for webpages.

    @deathshadow: Designmode: window.frames['wysiwyg'+el].document.designMode = "On";

    Are you unfamiliar with this? Is this ancient coding?

    @jedaisoul, Do you mean the snippet of code in my first or second post? The one in the first snippet is what the browsers generate when using the various document.execCommand() options. I know css is the way to go but FONT tag code is what the browsers still seem to generate when using document.execCommand() to change Font styles.

    I am involved in this since 1999. Nowadays I do more 3D development so all this might actually be outdated. Putting designmode on for browsers and using document.execCommand() to change fontstyle used to be the way to go for those HTML type of browser based email clients (and for example this webdeveloper forum post system) etc... the textarea is replaced for an iframe and designmode is turned on for the iframe. FCKeditor is one of the more popular WYSIWYG editors.

    Both comments make me feel stupid, is this no longer how this Works? Is there another way to do this now?

    @deathshadow, if you would have to make a content editable cross browser WYSIWYG system, how would you do that if I may ask?

    Last edited by safra; 08-27-2014 at 02:57 AM.

  7. #7
    Quote Originally Posted by safra View Post
    @deathshadow: Designmode: window.frames['wysiwyg'+el].document.designMode = "On";

    Are you unfamiliar with this? Is this ancient coding?
    Ok, appears to be an IE 6 vendor specific JS property, that has somehow wormed it's way into the WhatWG's "living document" HTML5 spec, but not the actual JS specification. (... and that's why this "living document" garbage is turning into a confusing train wreck that has no business being called a specification).

    Interesting, it forces contentEditable onto all elements in the document. I'm vaguely aware of contentEditable, in that it's something I'd never allow on a website in the first place.

    Quote Originally Posted by safra View Post
    I know css is the way to go but FONT tag code is what the browsers still seem to generate when using document.execCommand() to change Font styles.
    ... and there's a significant portion of WHY I'd never use that on a website... or document.execCommand for that matter; especially since the useful parts (copy and paste) are disabled by default and have to be manually enabled in a user.js file.

    Quote Originally Posted by safra View Post
    @deathshadow, if you would have to make a content editable cross browser WYSIWYG system, how would you do that if I may ask?
    I wouldn't... they piss me off; they vomit up inaccessible buggy broken rubbish markup that has no business on any website written after 1997 -- and are a contributor what makes me BLOCK scripting on websites. I'd sooner eat a bullet; there's a reason you shouldn't use WYSIWYGs for back end design, as it's even WORSE that the whole "screwing around in a paint program like Photoshop or Fireworks and calling it web design" idiocy.

    By its very nature the mere notion of a WYSIWYG for anything web related is nonsense, since HTML's job is to say what things ARE, NOT what they look like. The only thing you can be guaranteed of on the web is that "what you see is not what everyone else gets"; It's also why things like forums usually use BBCode instead of HTML.

    Lands sake, when it comes to user input -- like on a forums -- if users send HTML I'd be specialchars blocking it and/or running strip_tags on it because you can't trust users to be allowed to do that; and that's pretty much industry standard practice; pretty much defeating the point of "contentEditable" or that parent "designMode" thing. That's just security 101; ALL user input is suspect. That's why bbCode EXISTS.

    You also mentioned e-mails when I use the presence of HTML as one of my spam filters, since no legitimate e-mail I would expect to get has any reason to even have HTML in it! HTML-only, right to the junk folder. Multi-part alternative HTML + "Text only", show the text-only.

    Maybe, MAYBE I'd allow it on the back-end of a CMS; I've used FCKEditor in the past though I've soured on it since it dropped the F and has gone all weird on us; used to be lean, mean, fast and efficient even if it did vomit up re-re markup -- now it's a bloated train wreck akin to all the other bloated manure being smeared all over websites like jQuery, Mootools, Bootcrap, etc, etc...

    Of course you also mention IFRAMEs which we were told for over a decade to stop using for them being inaccessible trash and redundant to the more secure OBJECT tag, which of course is why instead of riding Microsoft's ass about their broken OBJECT implementation IFRAMES are now magically back in, less secure, as are other redundancies like EMBED suddenly allowed and all new halfwit redundancies like AUDIO and VIDEO introduced... It's why to me HTML 5 looks more like the worst of pre-STRICT coding practices and seems carefully crafted for the people who still vomit up HTML 3.2, and until recently were slapping 4 tranny on it. Now they get to wrap 5 lip-service around the same outdated inaccessible rubbish practices and call it "modern" and "the future"

    ... RIGHT!
    Last edited by deathshadow; 08-27-2014 at 07:38 AM.

  8. #8
    Join Date
    Feb 2007
    Thanks deathshadow for your constructive response...

    There are a lot of things I also do not like, unfortunately people do have expectations nowadays and like to be able to do certain things. I don't think we are doing ourselves a favor ignoring that hence our attempt to come up with a solution for this.

    We only need this for text areas (bold, italic, font style, size, color and links), are you saying there are good solid opensource bbcode libraries (I will do a search myself), userfriendly for non webdevelopers, which will also cross browser deal with my initial question ? And indeed ideally also handle copy /paste from other sources?
    Last edited by safra; 08-27-2014 at 12:10 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center



X vBulletin 4.2.2 Debug Information

  • Page Generation 0.14152 seconds
  • Memory Usage 2,923KB
  • Queries Executed 15 (?)
More Information
Template Usage (34):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (2)bbcode_code
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (8)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (72):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates