Item14206: PatternSkin fails to load foswiki_edit.js, pattern_edit.js

pencil
Priority: Enhancement
Current State: Confirmed
Released In: n/a
Target Release:
Applies To: Extension
Component: PatternSkin
Branches:
Reported By: FlorianSchlichting
Waiting For:
Last Change By: GeorgeClark
When editing a topic using the "classic" TML editor (not natedit, not TinyMCE), PatternSkin fails to load JavascriptFiles/foswiki_edit.js and PatternSkin/pattern_edit.js, both necessary for display and functioning of four buttons at the bottom right of the edit textarea that allow switching from monospaced to sans-serif font and vice-versa as well as increasing/decreasing the vertical size of the textarea.

The two javascript files are referenced at the top of templates/foswiki.pattern.tmpl as part of the "PatternSkin/pattern_edit" template, which in templates/edit.pattern.tmpl becomes part of "script:skintemplate:edit" and "script:skintemplate", which in templates/foswiki.tmpl is then put into the "script" template. This would be used for the foswiki "head" template, however PatternSkin (in templates/foswiki.pattern.tmpl) redefines "head" such that it doesn't include "script" but "head:script", which it defines to be a fixed list of javascript files necessary for view, but not including those for edit.

This seems to be broken since 065373f40d88cb567aeefb95acdc1631c8b842aa (ArthurClemens - Item12192: Fixes and enhancements after "improve typography" changes), moreover PatternSkin/pattern_edit.js disappeared in 76d87243d8ec316d29f8f2bff2fd860c7c7e09d6 (ArthurClemens - Item12192: use correct links to jquery css images; remove unused edit screen) [Why "unused"? It doesn't seem to use anything else??]

As this might be half-finished work, I'm not really sure what a good, forward-looking solution would look like, but I wanted to share what I did after upgrading from Foswiki 1.1.10 to 2.1.2 in order to bring this missing functionality back:

  • bring back PatternSkin/pattern_edit.js from 1.1.10

  • add "script" to "head:script" in =foswiki.pattern.tmpl

--- a/templates/foswiki.pattern.tmpl
+++ b/templates/foswiki.pattern.tmpl
@@ -55,7 +55,7 @@
 <meta name="robots" content="noindex" />%HTTP_EQUIV_ON_VIEW%
 <base href="%SCRIPTURL{%SCRIPTNAME%}%/%WEB%/%TOPIC%" /><!--[if IE]></base><![endif]-->%TMPL:END%
 
-%TMPL:DEF{"head:script"}%%TMPL:P{"LIBJS" id="JavascriptFiles/foswikiString" requires="JQUERYPLUGIN::FOSWIKI"}%%TMPL:P{"LIBJS" id="JavascriptFiles/foswikiPref" requires="JavascriptFiles/foswikiString"}%%TMPL:P{"LIBJS" id="JavascriptFiles/foswikiForm" requires="JavascriptFiles/foswikiString"}%%TMPL:P{"LIBJS" id="PatternSkin/pattern" requires="JavascriptFiles/foswikiPref,JavascriptFiles/foswikiForm"}%%TMPL:END%
+%TMPL:DEF{"head:script"}%%TMPL:P{"LIBJS" id="JavascriptFiles/foswikiString" requires="JQUERYPLUGIN::FOSWIKI"}%%TMPL:P{"LIBJS" id="JavascriptFiles/foswikiPref" requires="JavascriptFiles/foswikiString"}%%TMPL:P{"LIBJS" id="JavascriptFiles/foswikiForm" requires="JavascriptFiles/foswikiString"}%%TMPL:P{"LIBJS" id="PatternSkin/pattern" requires="JavascriptFiles/foswikiPref,JavascriptFiles/foswikiForm"}%%TMPL:P{"script"}%%TMPL:END%
 
 %TMPL:DEF{"head:css"}%%TMPL:P{"defaultstyle"}%%TMPL:END%

  • mark font-family attribute as important

--- a/pub/System/PatternSkinTheme/style_src.css
+++ b/pub/System/PatternSkinTheme/style_src.css
@@ -1146,10 +1146,10 @@ h4.foswikiSearchResultsHeader {
        width:100%;
 }
 .foswikiEditboxStyleMono {
-       font-family: "Bitstream Vera Sans Mono","Andale Mono",Courier,monospace;
+       font-family: "Bitstream Vera Sans Mono","Andale Mono",Courier,monospace !important;
 }
 .foswikiEditboxStyleProportional {
-       font-family: Arial, sans-serif;
+       font-family: Arial, sans-serif !important;
 }
 .patternSig {
        text-align:right

-- FlorianSchlichting - 27 Oct 2016

BTW, natedit seems to use sans-serif or monospaced font based upon the last selection made with the classic editor's buttons, but doesn't seem to display those buttons itself - and there's no other way to switch fonts?

-- FlorianSchlichting - 02 Nov 2016

I'm not sure that this is the right solution, but confirming as there is an issue here.

-- GeorgeClark - 20 Jan 2017
 

ItemTemplate edit

Summary PatternSkin fails to load foswiki_edit.js, pattern_edit.js
ReportedBy FlorianSchlichting
Codebase 2.1.3 beta1, 2.1.2, 2.1.1, 2.1.0, 2.1.0 beta1, 2.0.3, 2.0.2, 2.0.1, 2.0.0
SVN Range
AppliesTo Extension
Component PatternSkin
Priority Enhancement
CurrentState Confirmed
WaitingFor
Checkins
ReleasedIn n/a
CheckinsOnBranches
trunkCheckins
masterCheckins
ItemBranchCheckins
Release02x01Checkins
Release02x00Checkins
Release01x01Checkins
Topic revision: r2 - 20 Jan 2017, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy