froala-editor-sdk 1.3.0 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 495ecf38df41fef4489d7ce5608ad8c0b809b2c930ad54bcc29aa9f796eeea55
4
- data.tar.gz: 0bb5137357c2dba0cd1e3c71b3b4730970b03047307e19104cd0e2679b28d7ec
3
+ metadata.gz: 1af622d938752a582e3920540b6d6f69499e713288cb19a8fa629fdb75293402
4
+ data.tar.gz: 16a3011d48f23b977fc48ce1c1c192124bfad50a2d51be2a0e31b0acbc65b039
5
5
  SHA512:
6
- metadata.gz: 8bb73be9904214fecc2ba0844f2714345d553d033f00a5dd99794d4a8537351e159f9e6db46d7bbb71955cf055071cfbb4761d7e990f9ab431af3f4fbe050e4b
7
- data.tar.gz: e30bd14ba369410e8023d320ad549c619d0554399a60c74801a87e3deacfb968a5d0585745105f8aef8495f4692ad4b087765405308ef8c0b36e11c867ee5430
6
+ metadata.gz: e89a2db51b910aa645020665bd9204200e4e0b5be74b76066ed028d1c0f3631cbd92b995038707dddcd9fc66f077436d61423e3ecc06a628734a6b4aec348553
7
+ data.tar.gz: fe2c29e40b44f6fea24bff76f7c0872b2f45d2e84ed5aeeae962a1152912337c21ce8849f600e7323a709be5ec635e84b6df2d2adf0224c26ce858c4e6498664
@@ -1,11 +1,11 @@
1
- require 'mime-types'
2
- require 'mini_magick'
3
- require 'froala-editor-sdk/utils/validation'
4
- require 'froala-editor-sdk/utils/utils'
5
-
6
-
7
- require 'froala-editor-sdk/file'
8
- require 'froala-editor-sdk/image'
9
- require 'froala-editor-sdk/s3'
10
- require 'froala-editor-sdk/version'
11
- require 'froala-editor-sdk/video'
1
+ require 'mime-types'
2
+ require 'mini_magick'
3
+ require 'froala-editor-sdk/utils/validation'
4
+ require 'froala-editor-sdk/utils/utils'
5
+
6
+
7
+ require 'froala-editor-sdk/file'
8
+ require 'froala-editor-sdk/image'
9
+ require 'froala-editor-sdk/s3'
10
+ require 'froala-editor-sdk/version'
11
+ require 'froala-editor-sdk/video'
@@ -1,114 +1,114 @@
1
- module FroalaEditorSDK
2
-
3
- require 'fileutils'
4
-
5
- # File functionality.
6
- class File
7
-
8
- # Default options that are used if no options are passed to the upload function
9
- @default_options = {
10
- fieldname: 'file',
11
- validation: {
12
- allowedExts: [".txt", ".pdf", ".doc", ".json", ".html"],
13
- allowedMimeTypes: [ "text/plain", "application/msword", "application/x-pdf", "application/pdf", "application/json","text/html" ]
14
- },
15
- resize: nil,
16
- file_access_path: '/uploads/'
17
- }
18
-
19
- # Default upload path.
20
- @default_upload_path = "public/uploads/files"
21
-
22
- # Uploads a file to the server.
23
- # Params:
24
- # +params+:: File upload parameter mostly is "file".
25
- # +upload_path+:: Server upload path, a storage path where the file will be stored.
26
- # +options+:: Hash object that contains configuration parameters for uploading a file.
27
- # Returns json object
28
- def self.upload(params, upload_path = @default_upload_path, options = {})
29
-
30
- # Merge options.
31
- options = @default_options.merge(options)
32
-
33
- file = params[options[:fieldname]]
34
-
35
- if file
36
-
37
- # Validates the file extension and mime type.
38
- validation = Validation.check(file, options)
39
-
40
- # Uses the Utlis name function to generate a random name for the file.
41
- file_name = Utils.name(file)
42
- path = Rails.root.join(upload_path, file_name)
43
-
44
- # Saves the file on the server and returns the path.
45
- serve_url = save(file, path, options[:file_access_path])
46
-
47
- resize(options, path) if !options[:resize].nil?
48
-
49
- return {:link => serve_url}.to_json
50
- else
51
- return nil
52
- end
53
- end
54
-
55
- # Saves a file on the server.
56
- # Params:
57
- # +file+:: The uploaded file that will be saved on the server.
58
- # +path+:: The path where the file will be saved.
59
- def self.save (file, path, file_access_path)
60
-
61
- # Create directory if it doesn't exist.
62
- dirname = ::File.dirname(path)
63
- unless ::File.directory?(dirname)
64
- ::FileUtils.mkdir_p(dirname)
65
- end
66
-
67
- if ::File.open(path, "wb") {|f| f.write(file.read)}
68
-
69
- # Returns a public accessible server path.
70
- return "#{file_access_path}#{Utils.get_file_name(path)}"
71
- else
72
- return "error"
73
- end
74
- end
75
-
76
- # Deletes a file found on the server.
77
- # Params:
78
- # +file+:: The file that will be deleted from the server.
79
- # +path+:: The server path where the file resides.
80
- # Returns true or false.
81
- def self.delete(file = params[:file], path)
82
-
83
- file_path = Rails.root.join(path, ::File.basename(file))
84
- begin
85
- if ::File.delete(file_path)
86
- return true
87
- else
88
- return false
89
- end
90
- rescue => exception
91
- return false
92
- end
93
- end
94
-
95
- # Resizes an image based on the options provided.
96
- # The function resizes the original file,
97
- # Params:
98
- # +options+:: The options that contain the resize hash
99
- # +path+:: The path where the image is stored
100
- def self.resize (options, path)
101
- image = MiniMagick::Image.new(path)
102
- image.path
103
- image.resize("#{options[:resize][:width]}x#{options[:resize][:height]}")
104
- end
105
-
106
- class << self
107
- attr_reader :var
108
- end
109
-
110
- def var
111
- self.class.var
112
- end
113
- end
1
+ module FroalaEditorSDK
2
+
3
+ require 'fileutils'
4
+
5
+ # File functionality.
6
+ class File
7
+
8
+ # Default options that are used if no options are passed to the upload function
9
+ @default_options = {
10
+ fieldname: 'file',
11
+ validation: {
12
+ allowedExts: [".txt", ".pdf", ".doc", ".json", ".html"],
13
+ allowedMimeTypes: [ "text/plain", "application/msword", "application/x-pdf", "application/pdf", "application/json","text/html" ]
14
+ },
15
+ resize: nil,
16
+ file_access_path: '/uploads/'
17
+ }
18
+
19
+ # Default upload path.
20
+ @default_upload_path = "public/uploads/files"
21
+
22
+ # Uploads a file to the server.
23
+ # Params:
24
+ # +params+:: File upload parameter mostly is "file".
25
+ # +upload_path+:: Server upload path, a storage path where the file will be stored.
26
+ # +options+:: Hash object that contains configuration parameters for uploading a file.
27
+ # Returns json object
28
+ def self.upload(params, upload_path = @default_upload_path, options = {})
29
+
30
+ # Merge options.
31
+ options = @default_options.merge(options)
32
+
33
+ file = params[options[:fieldname]]
34
+
35
+ if file
36
+
37
+ # Validates the file extension and mime type.
38
+ validation = Validation.check(file, options)
39
+
40
+ # Uses the Utlis name function to generate a random name for the file.
41
+ file_name = Utils.name(file)
42
+ path = Rails.root.join(upload_path, file_name)
43
+
44
+ # Saves the file on the server and returns the path.
45
+ serve_url = save(file, path, options[:file_access_path])
46
+
47
+ resize(options, path) if !options[:resize].nil?
48
+
49
+ return {:link => serve_url}.to_json
50
+ else
51
+ return nil
52
+ end
53
+ end
54
+
55
+ # Saves a file on the server.
56
+ # Params:
57
+ # +file+:: The uploaded file that will be saved on the server.
58
+ # +path+:: The path where the file will be saved.
59
+ def self.save (file, path, file_access_path)
60
+
61
+ # Create directory if it doesn't exist.
62
+ dirname = ::File.dirname(path)
63
+ unless ::File.directory?(dirname)
64
+ ::FileUtils.mkdir_p(dirname)
65
+ end
66
+
67
+ if ::File.open(path, "wb") {|f| f.write(file.read)}
68
+
69
+ # Returns a public accessible server path.
70
+ return "#{file_access_path}#{Utils.get_file_name(path)}"
71
+ else
72
+ return "error"
73
+ end
74
+ end
75
+
76
+ # Deletes a file found on the server.
77
+ # Params:
78
+ # +file+:: The file that will be deleted from the server.
79
+ # +path+:: The server path where the file resides.
80
+ # Returns true or false.
81
+ def self.delete(file = params[:file], path)
82
+
83
+ file_path = Rails.root.join(path, ::File.basename(file))
84
+ begin
85
+ if ::File.delete(file_path)
86
+ return true
87
+ else
88
+ return false
89
+ end
90
+ rescue => exception
91
+ return false
92
+ end
93
+ end
94
+
95
+ # Resizes an image based on the options provided.
96
+ # The function resizes the original file,
97
+ # Params:
98
+ # +options+:: The options that contain the resize hash
99
+ # +path+:: The path where the image is stored
100
+ def self.resize (options, path)
101
+ image = MiniMagick::Image.new(path)
102
+ image.path
103
+ image.resize("#{options[:resize][:width]}x#{options[:resize][:height]}")
104
+ end
105
+
106
+ class << self
107
+ attr_reader :var
108
+ end
109
+
110
+ def var
111
+ self.class.var
112
+ end
113
+ end
114
114
  end
@@ -1,38 +1,38 @@
1
- module FroalaEditorSDK
2
- # Image functionality.
3
- class Image < File
4
-
5
- # Default options that are used if no options are passed to the upload function.
6
- @default_options = {
7
- fieldname: 'file',
8
- validation: {
9
- allowedExts: [".gif", ".jpeg", ".jpg", ".png", ".svg", ".blob"],
10
- allowedMimeTypes: [ "image/gif", "image/jpeg", "image/pjpeg", "image/x-png", "image/png", "image/svg+xml" ]
11
- },
12
- resize: nil,
13
- file_access_path: '/uploads/'
14
- }
15
-
16
- # Default upload path.
17
- @default_upload_path = "public/uploads/images"
18
-
19
- # Loads the images from a specific path
20
- # Params:
21
- # +path+:: The server path where the images are saved
22
- # Returns Json object
23
- def self.load_images(path, options = {})
24
-
25
- # Merge options.
26
- options = @default_options.merge(options)
27
-
28
- images = Dir["#{path}*"]
29
- all_images = []
30
-
31
- images.each do |img|
32
- all_images.push({url: "#{options[:file_access_path]}#{Utils.get_file_name(img)}"})
33
- end
34
-
35
- return all_images.to_json
36
- end
37
- end
1
+ module FroalaEditorSDK
2
+ # Image functionality.
3
+ class Image < File
4
+
5
+ # Default options that are used if no options are passed to the upload function.
6
+ @default_options = {
7
+ fieldname: 'file',
8
+ validation: {
9
+ allowedExts: [".gif", ".jpeg", ".jpg", ".png", ".svg", ".blob"],
10
+ allowedMimeTypes: [ "image/gif", "image/jpeg", "image/pjpeg", "image/x-png", "image/png", "image/svg+xml" ]
11
+ },
12
+ resize: nil,
13
+ file_access_path: '/uploads/'
14
+ }
15
+
16
+ # Default upload path.
17
+ @default_upload_path = "public/uploads/images"
18
+
19
+ # Loads the images from a specific path
20
+ # Params:
21
+ # +path+:: The server path where the images are saved
22
+ # Returns Json object
23
+ def self.load_images(path, options = {})
24
+
25
+ # Merge options.
26
+ options = @default_options.merge(options)
27
+
28
+ images = Dir["#{path}*"]
29
+ all_images = []
30
+
31
+ images.each do |img|
32
+ all_images.push({url: "#{options[:file_access_path]}#{Utils.get_file_name(img)}"})
33
+ end
34
+
35
+ return all_images.to_json
36
+ end
37
+ end
38
38
  end
@@ -1,96 +1,96 @@
1
- module FroalaEditorSDK
2
-
3
- # Uploads files to S3/AWS
4
- class S3
5
-
6
- # Builds a signature based on the options.
7
- # Params:
8
- # +options+:: The configuration params that are needed to compute the signature.
9
- def self.signature (options = nil)
10
- OpenSSL::HMAC.hexdigest(
11
- "SHA256",
12
- self.sign(
13
- self.sign(
14
- self.sign(
15
- self.sign(
16
- ("AWS4" + options[:secretKey]).force_encoding(Encoding::UTF_8),
17
- options[:'date-string']
18
- ),
19
- options[:region]
20
- ),
21
- "s3"
22
- ),
23
- "aws4_request"
24
- ),
25
- self.policy(options)
26
- )
27
- end
28
-
29
- # Builds a HMAC-SHA256 digest using key and data
30
- # Params:
31
- # +key+:: Key to use for creating the digest
32
- # +data+:: Data to be used for creating the digest
33
- def self.sign(key, data)
34
- OpenSSL::HMAC.digest(OpenSSL::Digest::SHA256.new, key, data.force_encoding(Encoding::UTF_8))
35
- end
36
-
37
- # Encodes to Base64 the policy data and replaces new lines chars.
38
- # Params:
39
- # +options+:: The configuration params that are needed to compute the signature.
40
- def self.policy (options = nil)
41
- Base64.encode64(self.policy_data(options).to_json).gsub("\n", "")
42
- end
43
-
44
- # Sets policy params, bucket that will be used max file size and other params.
45
- # Params:
46
- # +options+:: Configuration params that are needed to set the policy
47
- def self.policy_data (options = nil)
48
- {
49
- expiration: 10.hours.from_now.utc.iso8601,
50
- conditions: [
51
- ["starts-with", "$key", options[:keyStart]], # Start key/folder
52
- ["starts-with", "$Content-type", ""], # Content type
53
- {"x-requested-with": "xhr"}, # Request type
54
- {"x-amz-algorithm": options[:'x-amz-algorithm']}, # Encrytion Algorithm
55
- {"x-amz-date": options[:'x-amz-date']}, # Current Date
56
- {"x-amz-credential": options[:'x-amz-credential']}, # Encrypted Credentials
57
- {bucket: options[:bucket]}, # Bucket name
58
- {acl: options[:acl]}, # ACL property
59
- {success_action_status: "201"} # Response status 201 'file created'
60
- ]
61
- }
62
- end
63
-
64
- # Builds the amazon credential by appending access key, x-amz-date, region and 's3/aws4_request'
65
- # Params:
66
- # +options+:: Configuration params to generate the AWS response
67
- def self.getXamzCredential(options = nil)
68
- "#{options[:accessKey]}#{"/"}#{options[:'date-string']}#{"/"}#{options[:region]}#{"/"}#{"s3/aws4_request"}"
69
- end
70
-
71
- # Makes all the request in order and returns AWS hash response
72
- # Params:
73
- # +options+:: Configuration params to generate the AWS response.
74
- def self.data_hash (options = nil)
75
- options[:region] = 'us-east-1' if options[:region].nil? || options[:region] == 's3'
76
- options[:'date-string'] = Time.now.strftime("%Y%m%d")
77
- options[:'x-amz-algorithm'] = "AWS4-HMAC-SHA256"
78
- options[:'x-amz-credential'] = self.getXamzCredential(options)
79
- options[:'x-amz-date'] = options[:'date-string'] + "T000000Z"
80
-
81
- {
82
- :bucket => options[:bucket], # Upload bucket
83
- :region => options[:region] != 'us-east-1' ? "s3-#{options[:region]}" : 's3', # Upload region
84
- :keyStart => options[:keyStart], # Start key/folder
85
- :params => {
86
- :acl => options[:acl], # ACL property 'public-read'
87
- :policy => self.policy(options), # Defined policy
88
- :'x-amz-algorithm' => options[:'x-amz-algorithm'], # Encrytion Algorithm
89
- :'x-amz-credential' => options[:'x-amz-credential'], # Encrypted Credentials
90
- :'x-amz-date' => options[:'x-amz-date'], # Current Date
91
- :'x-amz-signature' => self.signature(options), # Defined signature
92
- }
93
- }
94
- end
95
- end
1
+ module FroalaEditorSDK
2
+
3
+ # Uploads files to S3/AWS
4
+ class S3
5
+
6
+ # Builds a signature based on the options.
7
+ # Params:
8
+ # +options+:: The configuration params that are needed to compute the signature.
9
+ def self.signature (options = nil)
10
+ OpenSSL::HMAC.hexdigest(
11
+ "SHA256",
12
+ self.sign(
13
+ self.sign(
14
+ self.sign(
15
+ self.sign(
16
+ ("AWS4" + options[:secretKey]).force_encoding(Encoding::UTF_8),
17
+ options[:'date-string']
18
+ ),
19
+ options[:region]
20
+ ),
21
+ "s3"
22
+ ),
23
+ "aws4_request"
24
+ ),
25
+ self.policy(options)
26
+ )
27
+ end
28
+
29
+ # Builds a HMAC-SHA256 digest using key and data
30
+ # Params:
31
+ # +key+:: Key to use for creating the digest
32
+ # +data+:: Data to be used for creating the digest
33
+ def self.sign(key, data)
34
+ OpenSSL::HMAC.digest(OpenSSL::Digest::SHA256.new, key, data.force_encoding(Encoding::UTF_8))
35
+ end
36
+
37
+ # Encodes to Base64 the policy data and replaces new lines chars.
38
+ # Params:
39
+ # +options+:: The configuration params that are needed to compute the signature.
40
+ def self.policy (options = nil)
41
+ Base64.encode64(self.policy_data(options).to_json).gsub("\n", "")
42
+ end
43
+
44
+ # Sets policy params, bucket that will be used max file size and other params.
45
+ # Params:
46
+ # +options+:: Configuration params that are needed to set the policy
47
+ def self.policy_data (options = nil)
48
+ {
49
+ expiration: 10.hours.from_now.utc.iso8601,
50
+ conditions: [
51
+ ["starts-with", "$key", options[:keyStart]], # Start key/folder
52
+ ["starts-with", "$Content-type", ""], # Content type
53
+ {"x-requested-with": "xhr"}, # Request type
54
+ {"x-amz-algorithm": options[:'x-amz-algorithm']}, # Encrytion Algorithm
55
+ {"x-amz-date": options[:'x-amz-date']}, # Current Date
56
+ {"x-amz-credential": options[:'x-amz-credential']}, # Encrypted Credentials
57
+ {bucket: options[:bucket]}, # Bucket name
58
+ {acl: options[:acl]}, # ACL property
59
+ {success_action_status: "201"} # Response status 201 'file created'
60
+ ]
61
+ }
62
+ end
63
+
64
+ # Builds the amazon credential by appending access key, x-amz-date, region and 's3/aws4_request'
65
+ # Params:
66
+ # +options+:: Configuration params to generate the AWS response
67
+ def self.getXamzCredential(options = nil)
68
+ "#{options[:accessKey]}#{"/"}#{options[:'date-string']}#{"/"}#{options[:region]}#{"/"}#{"s3/aws4_request"}"
69
+ end
70
+
71
+ # Makes all the request in order and returns AWS hash response
72
+ # Params:
73
+ # +options+:: Configuration params to generate the AWS response.
74
+ def self.data_hash (options = nil)
75
+ options[:region] = 'us-east-1' if options[:region].nil? || options[:region] == 's3'
76
+ options[:'date-string'] = Time.now.strftime("%Y%m%d")
77
+ options[:'x-amz-algorithm'] = "AWS4-HMAC-SHA256"
78
+ options[:'x-amz-credential'] = self.getXamzCredential(options)
79
+ options[:'x-amz-date'] = options[:'date-string'] + "T000000Z"
80
+
81
+ {
82
+ :bucket => options[:bucket], # Upload bucket
83
+ :region => options[:region] != 'us-east-1' ? "s3-#{options[:region]}" : 's3', # Upload region
84
+ :keyStart => options[:keyStart], # Start key/folder
85
+ :params => {
86
+ :acl => options[:acl], # ACL property 'public-read'
87
+ :policy => self.policy(options), # Defined policy
88
+ :'x-amz-algorithm' => options[:'x-amz-algorithm'], # Encrytion Algorithm
89
+ :'x-amz-credential' => options[:'x-amz-credential'], # Encrypted Credentials
90
+ :'x-amz-date' => options[:'x-amz-date'], # Current Date
91
+ :'x-amz-signature' => self.signature(options), # Defined signature
92
+ }
93
+ }
94
+ end
95
+ end
96
96
  end
@@ -1,19 +1,19 @@
1
- module FroalaEditorSDK
2
-
3
- # Basic utility functionality.
4
- class Utils
5
-
6
- # Generates a random name that will be used as name for files.
7
- def self.name (file)
8
- name = SecureRandom.urlsafe_base64
9
- ext = ::File.extname(file.original_filename)
10
-
11
- return "#{name}#{ext}"
12
- end
13
-
14
- # Returns file name from an file path
15
- def self.get_file_name(path)
16
- return ::File.basename(path)
17
- end
18
- end
1
+ module FroalaEditorSDK
2
+
3
+ # Basic utility functionality.
4
+ class Utils
5
+
6
+ # Generates a random name that will be used as name for files.
7
+ def self.name (file)
8
+ name = SecureRandom.urlsafe_base64
9
+ ext = ::File.extname(file.original_filename)
10
+
11
+ return "#{name}#{ext}"
12
+ end
13
+
14
+ # Returns file name from an file path
15
+ def self.get_file_name(path)
16
+ return ::File.basename(path)
17
+ end
18
+ end
19
19
  end
@@ -1,35 +1,35 @@
1
- module FroalaEditorSDK
2
-
3
- # Image Validation class.
4
- # Checks if image is matching the allowed extensions and mime types.
5
- class Validation
6
- require "mime-types"
7
-
8
- def self.ext(ext, options)
9
- raise "Not allowed" unless options[:validation][:allowedExts].include?(ext)
10
- end
11
-
12
- def self.mime(mime, options)
13
- raise "Invalid mime type" unless options[:validation][:allowedMimeTypes].include?(mime)
14
- end
15
-
16
- # Checks an image with the options.
17
- # Params:
18
- # +file+:: The image that will be validated.
19
- # +options+:: The image options that contain allowed extensions and mime types.
20
- # Raises exception if the image has not passed the validation
21
- def self.check(file, options = nil)
22
-
23
- mime = file.content_type
24
- ext = ::File.extname(file.original_filename)
25
-
26
- # Check if there is custom validation.
27
- if options[:validation].class != Proc
28
- ext(ext, options) && mime(mime, options)
29
- else
30
- options[:validation].call(file.path, mime)
31
- end
32
- end
33
-
34
- end
1
+ module FroalaEditorSDK
2
+
3
+ # Image Validation class.
4
+ # Checks if image is matching the allowed extensions and mime types.
5
+ class Validation
6
+ require "mime-types"
7
+
8
+ def self.ext(ext, options)
9
+ raise "Not allowed" unless options[:validation][:allowedExts].include?(ext)
10
+ end
11
+
12
+ def self.mime(mime, options)
13
+ raise "Invalid mime type" unless options[:validation][:allowedMimeTypes].include?(mime)
14
+ end
15
+
16
+ # Checks an image with the options.
17
+ # Params:
18
+ # +file+:: The image that will be validated.
19
+ # +options+:: The image options that contain allowed extensions and mime types.
20
+ # Raises exception if the image has not passed the validation
21
+ def self.check(file, options = nil)
22
+
23
+ mime = file.content_type
24
+ ext = ::File.extname(file.original_filename)
25
+
26
+ # Check if there is custom validation.
27
+ if options[:validation].class != Proc
28
+ ext(ext, options) && mime(mime, options)
29
+ else
30
+ options[:validation].call(file.path, mime)
31
+ end
32
+ end
33
+
34
+ end
35
35
  end
@@ -1,9 +1,9 @@
1
- module FroalaEditorSDK
2
- module Version
3
- Major = 1
4
- Minor = 3
5
- Tiny = 0
6
-
7
- String = "#{Major}.#{Minor}.#{Tiny}"
8
- end
1
+ module FroalaEditorSDK
2
+ module Version
3
+ Major = 4
4
+ Minor = 0
5
+ Tiny = 1
6
+
7
+ String = "#{Major}.#{Minor}.#{Tiny}"
8
+ end
9
9
  end
@@ -1,20 +1,20 @@
1
- module FroalaEditorSDK
2
-
3
- # Video functionality.
4
- class Video < File
5
-
6
- # Default options that are used if no options are passed to the upload function
7
- @default_options = {
8
- fieldname: 'file',
9
- validation: {
10
- allowedExts: [".mp4", ".webm", ".ogg"],
11
- allowedMimeTypes: [ "video/mp4", "video/webm", "video/ogg" ]
12
- },
13
- resize: nil,
14
- file_access_path: '/uploads/'
15
- }
16
-
17
- # Default upload path.
18
- @default_upload_path = "public/uploads/videos"
19
- end
1
+ module FroalaEditorSDK
2
+
3
+ # Video functionality.
4
+ class Video < File
5
+
6
+ # Default options that are used if no options are passed to the upload function
7
+ @default_options = {
8
+ fieldname: 'file',
9
+ validation: {
10
+ allowedExts: [".mp4", ".webm", ".ogg"],
11
+ allowedMimeTypes: [ "video/mp4", "video/webm", "video/ogg" ]
12
+ },
13
+ resize: nil,
14
+ file_access_path: '/uploads/'
15
+ }
16
+
17
+ # Default upload path.
18
+ @default_upload_path = "public/uploads/videos"
19
+ end
20
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: froala-editor-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Froala Labs
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-16 00:00:00.000000000 Z
11
+ date: 2021-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mime-types
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.9'
33
+ version: 4.0.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '2.9'
40
+ version: 4.0.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: mini_magick
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '4.5'
55
55
  description: Ruby SDK for Froala Editor
56
- email:
56
+ email:
57
57
  executables: []
58
58
  extensions: []
59
59
  extra_rdoc_files: []
@@ -70,7 +70,7 @@ homepage: https://github.com/froala/wysiwyg-editor-ruby-sdk
70
70
  licenses:
71
71
  - MIT
72
72
  metadata: {}
73
- post_install_message:
73
+ post_install_message:
74
74
  rdoc_options: []
75
75
  require_paths:
76
76
  - lib
@@ -85,8 +85,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
85
  - !ruby/object:Gem::Version
86
86
  version: '0'
87
87
  requirements: []
88
- rubygems_version: 3.0.3
89
- signing_key:
88
+ rubygems_version: 3.0.3.1
89
+ signing_key:
90
90
  specification_version: 4
91
91
  summary: Ruby on Rails SDK for Froala WYSIWYG Editor.
92
92
  test_files: []