Jump to content

Best place to insert Script.JS


freedowsRoO

Recommended Posts

Hello!

I am trying to use a text editor in my application but I am not getting it, i don't know what the best place to declare the scripts because they need to be before my DIV. 

 

My HTML code is this:

<!DOCTYPE html>
<html lang="en" >
<head>
  <meta charset="UTF-8">
  <link rel='stylesheet' href='https://cdn.quilljs.com/1.3.6/quill.snow.css'>
  <link rel="stylesheet" href="./style.css">  
  <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.2/jquery.min.js'></script>	
</head>
<body>

<div id="editor-container">
  
</div>

<script src='https://cdn.quilljs.com/1.3.6/quill.js'></script>
<script  src="./script.js"></script>

</body>
</html>

 

I need to make the HTML above works in UNIGUI, I'm putting the following lines inside: ServerModule> Custom Files

<link rel='stylesheet' href='https://cdn.quilljs.com/1.3.6/quill.snow.css'>
files/style.css

 

And the following lines inside: HTMLFrame > HTML

<div id="editor-container">

</div>

<script src='https://cdn.quilljs.com/1.3.6/quill.js'></script>
<script  src="files/script.js"></script>

 

I'm trying a lot of things and nothing works. I guess the problem is in the HTMLFrame because when i look the code by pressing F12 the scripts:

<script src='https://cdn.quilljs.com/1.3.6/quill.js'></script>
<script  src="files/script.js"></script>

Doesn't appears in the code.

 

Thanks in advance.

 

The HTML project with the editor: .editor.rar

Link to comment
Share on other sites

3 minutes ago, freedowsRoO said:

I'm putting the following lines inside: ServerModule> Custom Files


<link rel='stylesheet' href='https://cdn.quilljs.com/1.3.6/quill.snow.css'>
<link rel="stylesheet" href="./style.css">  
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.2/jquery.min.js'></script>

Hi,

In CustomFiles:

https://cdn.quilljs.com/1.3.6/quill.snow.css
files/style.css

 

  • Like 1
Link to comment
Share on other sites

6 minutes ago, Sherzod said:

Hi,

In CustomFiles:


https://cdn.quilljs.com/1.3.6/quill.snow.css
files/style.css

 

Thanks sherzod but not work yet.

 

My CustomFiles:

https://cdn.quilljs.com/1.3.6/quill.snow.css
files/style.css

 

My HTML:

<div id="editor-container">

</div>

<script src='https://cdn.quilljs.com/1.3.6/quill.js'></script>
<script  src="files/script.js"></script>

 

My unigui test project: 

EmailBI.rar

Link to comment
Share on other sites

8 minutes ago, freedowsRoO said:

The <script> tag need's to below the DIV and UNIGUI put the tag after the <HEAD> tag.

OK, try this:

1. CustomFiles:

https://cdn.quilljs.com/1.3.6/quill.snow.css
files/style.css
https://cdn.quilljs.com/1.3.6/quill.js

2. UniHTMLFrame1.HTML = 

<div id="editor-container">

</div>

3. UniHTMLFrame1.AfterScript = 

var Delta = Quill.import('delta');
var quill = new Quill('#editor-container', {
  modules: {
    toolbar: true
  },
  placeholder: 'Compose an epic...',
  theme: 'snow'
});

// Store accumulated changes
var change = new Delta();
quill.on('text-change', function(delta) {
  change = change.compose(delta);
});

// Save periodically
setInterval(function() {
  if (change.length() > 0) {
    console.log('Saving changes', change);
    /* 
    Send partial changes
    $.post('/your-endpoint', { 
      partial: JSON.stringify(change) 
    });
    
    Send entire document
    $.post('/your-endpoint', { 
      doc: JSON.stringify(quill.getContents())
    });
    */
    change = new Delta();
  }
}, 5*1000);

// Check for unsaved data
window.onbeforeunload = function() {
  if (change.length() > 0) {
    return 'There are unsaved changes. Are you sure you want to leave?';
  }
}

 

  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...