Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

MBS FileMaker Plugin Example Databases

TinyMCE

All examples are included with download of MBS FileMaker Plugin.

TinyMCE.fmp12

Overview
Tables 1
Relationships 0
Layouts 1
Scripts 6
Value Lists 0
Custom Functions 0
Custom Menus 33
File Options
Default custom menu set [Standard FileMaker Menus]
Default theme Classic
When opening file
Minimum allowed version 12.0
Login using Account Name; Account= Admin
Allow user to save password On
Require iOS passcode Off
Show Sign-in fields Off
Switch to layout TinyMCE
Hide all toolbars Off
Script triggers
OnFirstWindowOpen Script: StartUP
OnLastWindowClose Off
OnWindowOpen Off
OnWindowClose Off
OnFileAVPlayerChange Off
OnWindowTransaction Off
Thumbnail Settings
Generate Thumbnails On; Temporary

 

Tables

Table Name
Statistics
Comments
Occurrences in Relationship Graph
TinyMCE
2 fields defined, 1 record
TinyMCE

Fields

Table Name: TinyMCE - 2 Fields
Field Name Type Options Comments On Layouts In Relationships In Scripts In Value Lists
Text Normal, Text Auto-Enter:
  • Allow editing
Validation:
  • Only during data entry
Storage:
  • Repetitions: 1
  • Indexing: None
  • Automatically create indexes as needed
  • Index Language: German
      HTMLText Normal, Text Auto-Enter:
      • Allow editing
      Validation:
      • Only during data entry
      Storage:
      • Repetitions: 1
      • Indexing: None
      • Automatically create indexes as needed
      • Index Language: German

          Layout Objects: TinyMCE

          Regular Fields

          Field Name: TinyMCE::Text
          Field Properties Coordinates Field Format Field Behavior Quick Find
          • Top: 24 pt
          • Left: 66 pt
          • Bottom: 248 pt
          • Right: 403 pt
          • Anchoring: Left, Top
          Field Format:
          • Edit Box
          Field Behavior:
          • Allow field to be entered: In Find mode, In Browse mode
          • Disable visual spell-checking
          • Touch keyboard type: System Default
          • Go to next field using: Tab key
          Yes

          Field Name: TinyMCE::HTMLText
          Field Properties Coordinates Field Format Field Behavior Quick Find
          • Top: 24 pt
          • Left: 480 pt
          • Bottom: 248 pt
          • Right: 841 pt
          • Anchoring: Left, Top
          Field Format:
          • Edit Box
          Field Behavior:
          • Allow field to be entered: In Find mode, In Browse mode
          • Disable visual spell-checking
          • Touch keyboard type: System Default
          • Go to next field using: Tab key
          Yes

          Group Buttons

          Button Properties Coordinates Script/Script Step
            Type:
          • Text: Set
            Additional Properties:
          • Change to hand cursor over button
          • Rounded
          • Top: 255 pt
          • Left: 66 pt
          • Bottom: 280 pt
          • Right: 133 pt
          • Anchoring: Left, Top
          Perform Script [ “Load” ]

          Scripts:


          Button Properties Coordinates Script/Script Step
            Type:
          • Text: Get
            Additional Properties:
          • Change to hand cursor over button
          • Rounded
          • Top: 255 pt
          • Left: 480 pt
          • Bottom: 280 pt
          • Right: 547 pt
          • Anchoring: Left, Top
          Perform Script [ “Save” ]

          Scripts:


          Button Properties Coordinates Script/Script Step
            Type:
          • Text: <<
            Additional Properties:
          • Change to hand cursor over button
          • Rounded
          • Top: 111 pt
          • Left: 420 pt
          • Bottom: 136 pt
          • Right: 463 pt
          • Anchoring: Left, Top
          Set Field [ TinyMCE::Text; TinyMCE::HTMLText ]

          Fields:


          Button Properties Coordinates Script/Script Step
            Type:
          • Text: Show
            Additional Properties:
          • Change to hand cursor over button
          • Rectangular
          • Top: 630 pt
          • Left: 132 pt
          • Bottom: 655 pt
          • Right: 193 pt
          • Anchoring: Left, Top
          Set Variable [ $r; Value:MBS( "WebView.RunJavaScript" ; "HTMLEditor"; "tinyMCE.get('elm1').show();" ) ]

          Button Properties Coordinates Script/Script Step
            Type:
          • Text: Hide
            Additional Properties:
          • Change to hand cursor over button
          • Rectangular
          • Top: 630 pt
          • Left: 66 pt
          • Bottom: 655 pt
          • Right: 127 pt
          • Anchoring: Left, Top
          Set Variable [ $r; Value:MBS( "WebView.RunJavaScript" ; "HTMLEditor"; "tinyMCE.get('elm1').hide();" ) ]

          Web Viewer Controls

          Web Viewer Control Properties Coordinates Web Address
            Object Name:
          • HTMLEditor
            Additional Properties:
          • Allow interaction with web viewer content
          • Automatically encode URL
          • Top: 288 pt
          • Left: 66 pt
          • Bottom: 613 pt
          • Right: 841 pt
          • Anchoring: Left, Top

          Script Hierarchy

          StartUP
          WebViewer
          Save
          Load
          Reset
          Insert Text

          Next Script: [WebViewer]
          Script Name StartUP
          Run script with full access privileges Off
          Siri Shortcut Visible Off
          Include In Menu Yes
          Layouts that use this script
            Scripts that use this script
              Script Definition
              Script Steps
              • #enable debug
              • // Set Variable [ $result; Value:MBS("Trace") ]
              • #init webviewer extension
              • If [ Get ( HostApplicationVersion ) = "" /* on server? */ ]
              • #find HTML code
              • Set Variable [ $databasePath; Value:Get(FilePath) ]
              • Set Variable [ $databasePath; Value:MBS("Path.FilemakerPathToNativePath"; $databasePath) ]
              • Set Variable [ $databasePath; Value:Substitute ( $databasePath ; ".fp7" ; ".fmp12") ]
              • Set Variable [ $databaseName; Value:Get(FileName) & ".fmp12" ]
              • Set Variable [ $path; Value:Substitute ( $databasePath ; $databaseName ; "tinymce/index.html" ) ]
              • If [ Get ( SystemPlatform ) = -2 or GetAsNumber ( Get(ApplicationVersion)) ≥ 16 ]
              • Set Variable [ $path; Value:"file://" & Substitute ( $path; "\\" ; "/" ) ]
              • End If
              • Set Web Viewer [ Object Name: "HTMLEditor"; URL: $path ]
              • Else [ ]
              • Set Web Viewer [ Object Name: "HTMLEditor"; URL: "http://www.monkeybreadsoftware.com/filemaker/examples/tinymce/index.html" ]
              • End If
              Fields used in this script
                Scripts used in this script
                  Layouts used in this script
                    Tables used in this script
                      Table occurrences used by this script
                        Custom Functions used by this script
                          Custom menu set used by this script

                            Previous Script: [StartUP] Next Script: [Save]
                            Script Name WebViewer
                            Run script with full access privileges Off
                            Siri Shortcut Visible Off
                            Include In Menu Yes
                            Layouts that use this script
                              Scripts that use this script
                                Script Definition
                                Script Steps
                                Fields used in this script
                                Scripts used in this script
                                  Layouts used in this script
                                    Tables used in this script
                                    Table occurrences used by this script
                                    Custom Functions used by this script
                                      Custom menu set used by this script

                                        Previous Script: [WebViewer] Next Script: [Load]
                                        Script Name Save
                                        Run script with full access privileges Off
                                        Siri Shortcut Visible Off
                                        Include In Menu Yes
                                        Layouts that use this script
                                        Scripts that use this script
                                          Script Definition
                                          Script Steps
                                          • #run Javascript to move html into form field
                                          • Set Variable [ $r; Value:MBS( "WebView.RunJavaScript" ; "HTMLEditor"; "try { formtest.output.value = tinyMCE.get('elm1').getContent(); } catch (e) { alert(e); }" ) ]
                                          • #pick text from form field
                                          • Set Variable [ $text; Value:MBS( "WebView.GetFormTextAreaValue" ; "HTMLEditor"; "formtest"; "output"; 0 ) ]
                                          • #Replace new line characters to ¶ like FMP prefers them
                                          • Set Variable [ $text; Value:MBS( "Text.ReplaceNewline"; $text; 1) ]
                                          • #Remove any control codes
                                          • Set Variable [ $text; Value:MBS( "Text.RemoveControlCharacters"; $text) ]
                                          • #Put in field
                                          • Set Field [ TinyMCE::HTMLText; $text ]
                                          • #Remove the unload handler which could make trouble
                                          • Set Variable [ $r; Value:MBS( "WebView.RunJavaScript" ; "HTMLEditor"; "window.onbeforeunload = null;") ]
                                          Fields used in this script
                                          Scripts used in this script
                                            Layouts used in this script
                                              Tables used in this script
                                              Table occurrences used by this script
                                              Custom Functions used by this script
                                                Custom menu set used by this script

                                                  Previous Script: [Save] Next Script: [Reset]
                                                  Script Name Load
                                                  Run script with full access privileges Off
                                                  Siri Shortcut Visible Off
                                                  Include In Menu Yes
                                                  Layouts that use this script
                                                  Scripts that use this script
                                                    Script Definition
                                                    Script Steps
                                                    • #Change line endings to LF
                                                    • Set Variable [ $text; Value:MBS( "Text.ReplaceNewline"; TinyMCE::Text; 2) ]
                                                    • #Put text in form field
                                                    • Set Variable [ $r; Value:MBS( "WebView.SetFormTextAreaValue" ; "HTMLEditor"; "formtest"; "output"; $text; 0 ) ]
                                                    • #Put text in javascript
                                                    • Set Variable [ $r; Value:MBS( "WebView.RunJavaScript" ; "HTMLEditor"; "try { tinyMCE.get('elm1').setContent(formtest.output.value); } catch (e) { alert(e); }" ) ]
                                                    • #clear unload handler to avoid trouble
                                                    • Set Variable [ $r; Value:MBS( "WebView.RunJavaScript" ; "HTMLEditor"; "window.onbeforeunload = null;") ]
                                                    Fields used in this script
                                                    Scripts used in this script
                                                      Layouts used in this script
                                                        Tables used in this script
                                                        Table occurrences used by this script
                                                        Custom Functions used by this script
                                                          Custom menu set used by this script

                                                            Previous Script: [Load] Next Script: [Insert Text]
                                                            Script Name Reset
                                                            Run script with full access privileges Off
                                                            Siri Shortcut Visible Off
                                                            Include In Menu Yes
                                                            Layouts that use this script
                                                              Scripts that use this script
                                                                Script Definition
                                                                Script Steps
                                                                • Set Variable [ $r; Value:MBS( "WebView.RunJavaScript" ; "HTMLEditor"; "window.onbeforeunload = null;") ]
                                                                • Set Web Viewer [ Object Name: "HTMLEditor"; Action: Reset ]
                                                                Fields used in this script
                                                                  Scripts used in this script
                                                                    Layouts used in this script
                                                                      Tables used in this script
                                                                        Table occurrences used by this script
                                                                          Custom Functions used by this script
                                                                            Custom menu set used by this script

                                                                              Previous Script: [Reset]
                                                                              Script Name Insert Text
                                                                              Run script with full access privileges Off
                                                                              Siri Shortcut Visible Off
                                                                              Include In Menu Yes
                                                                              Layouts that use this script
                                                                                Scripts that use this script
                                                                                  Script Definition
                                                                                  Script Steps
                                                                                  • #insert some HTML at the current cursor point
                                                                                  • Set Variable [ $r; Value:MBS( "WebView.RunJavaScript" ; "HTMLEditor"; "try { tinyMCE.get('elm1').execCommand('mceInsertContent', false, ' <b>bolded text</b> '); } catch (e) { alert(e); }" ) ]
                                                                                  Fields used in this script
                                                                                    Scripts used in this script
                                                                                      Layouts used in this script
                                                                                        Tables used in this script
                                                                                          Table occurrences used by this script
                                                                                            Custom Functions used by this script
                                                                                              Custom menu set used by this script

                                                                                                Download example: TinyMCE

                                                                                                Used functions: